以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]表视图  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=190309)

--  作者:江南小镇
--  发布时间:2024/1/30 19:56:00
--  [求助]表视图
老师好,下面的保存列属性想改成这样的格式[第一列],[第二列],[第三列]........,谢谢老师




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 \'获得列位置和宽度
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("|")

Tables("视图").current("视图名") = e.Form.controls("combobox1").value
Tables("视图").current("视图属性") = s
DataTables("视图").save()

If DataTables.Contains("视图") Then
    DataTables.Delete("视图")
End If
e.Form.close

--  作者:有点蓝
--  发布时间:2024/1/30 20:14:00
--  
Dim s As String = CurrentTable.GetColVisibleWidth \'获得列位置和宽度
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) & "]"
    End If 
Next
s = s.Trim(",")

--  作者:江南小镇
--  发布时间:2024/1/30 20:28:00
--  
老师谢谢