Dim cmd As New SQLCommand
cmd.C
Dim dt As datatable
If Vars("类型") = "查询" Then
cmd.CommandText = "" & Vars("查询") & "" & " where 1<>1"
Else If Vars("类型") = "存储" Then
cmd.CommandText = Vars("查询")
End If
dt = cmd.ExecuteReader()
Dim lst As String
For Each dc As DataCol In dt.dataCols
lst = dc.name & "|" & lst
Next
Tables("Bsfilter").Cols("listed").Combolist = "" & lst & ""
上面代码是提取后台数据表的所有列名,做为某列的列表项目。
当语句为select * from Vw_zycybrjk这样类型的正常,而语句是存储过程exec PROC_DI_zygfbrjsxd时报错。
这两个查询语句在SQL执行框里运行正常。
此主题相关图片如下:未命名.jpg
如果把思路改成预先将所有数据Fill到某窗口某表,则正常。
If Vars("类型") = "存储" Then
Dim lst1 As String
For Each c As col In Tables("主窗口_Table1").Cols
lst1 = c.name & "|" & lst1
Next
Tables("Bsfilter").Cols("listed").Combolist = "" & lst1 & ""
End If
[此贴子已经被作者于2010-10-28 11:50:02编辑过]