老师好,能保存成这样的视图格式吗 编号,50|日期,120|年,40|季,30|月,30|项目,60|项目ID,80
下面是保存视图的代码
Dim bm As String = GetConfigValue("bm","")
If e.Form.controls("combobox1").value = Nothing Then
MessageBox.Show("没有输入视图名称,请命名!")
Return
End If
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Select DISTINCT Count(表名) Fr om {视图} WHERE 表名 = '" & bm & "' and 视图名 = '" & e.Form.controls("combobox1").value & "'"
If cmd.ExecuteScalar() > 0 Then
MessageBox.Show("该视图名已经存在,请重新命名!")
Return
End If
Tables("视图").addnew()
'Tables("视图").current("工号") = dr
Tables("视图").current("表名") = bm
Dim s As String = CurrentTable.GetColVisibleWidth '获得列位置和宽度
Tables("视图").current("视图名") = e.Form.controls("combobox1").value
Tables("视图").current("视图属性") = s
DataTables("视图").save()
If DataTables.Contains("视图") Then
DataTables.Delete("视图")
End If
e.Form.close
Dim s As String = "编号|50|日期|120|年|40|季|30|月|30|项目|60|项目ID|80"
Dim ss() As String = s.Split("|")
s = ""
For i As Integer = 0 To ss.Length - 1
If i Mod 2 = 0 Then
s = s & "|" & ss(i)
Else
s = s & "," & ss(i)
End If
Next
s = s.Trim("|")
Output.Show(s)
老师,窗口表筛选和排列后,通过保存按钮保存成下面视图格式
"编号,50|日期,120|年,40"然后保存到视图表中,老师的代码不能理解。
都是很基础的代码,有什么看不懂的
……
Dim s As String = CurrentTable.GetColVisibleWidthDim ss() As String = s.Split("|")
s = ""
For i As Integer = 0 To ss.Length - 1
If i Mod 2 = 0 Then
s = s & "|" & ss(i)
Else
s = s & "," & ss(i)
End If
Next
s = s.Trim("|")
Tables("视图").current("视图属性") = s