Dim dt As DataTable
Dim cmd As New SQLCommand
Dim filter As String
cmd.ConnectionName = _DBSource1
Filter = "[一级单位] = '" & _userDW1 & "' and [三级单位] = '" & _userDW3 & "'"
cmd.CommandText = "SELECT 工作证号 as 工号,姓名,一级单位,二级单位,三级单位 From {人资_职工信息} where " & filter & " "
dt = cmd.ExecuteReader()
dt.DataCols.Add("选择", Gettype(Boolean))
Tables(e.form.name & "_table1").datasource = dt
Tables(e.form.name & "_table1").autosizecols()
Tables(e.form.name & "_table1").AllowEdit = True
这段代码运行时出现图提示
图片内容为“不存在名为""的datatable
[此贴子已经被作者于2013-3-12 13:37:40编辑过]