Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinForm.ComboBox
cmd.CommandText = "SELECT DISTINCT 单位名称 From {加工单位} Where 单位类型 = '供货单位'"
dt = cmd.ExecuteReader()
cmb = e.Form.Controls("ComboBox2")
cmb.ComboList= dt.GetComboListString("供货单位")
这样的动态加载列表项目错在哪里?
DISTINCT 单位名称
与dt.GetComboListString("供货单位")显然对不上,所以错误,
改成dt.GetComboListString("单位名称")试试
是笔误吧:
cmb.ComboList= dt.GetComboListString("
单位名称")
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinForm.ComboBox
cmd.CommandText = "SELECT DISTINCT 单位名称 From {加工单位} Where 单位类型 = '供货单位'"
dt = cmd.ExecuteReader()
cmb = e.Form.Controls("ComboBox2")
cmb.ComboList= dt.GetComboListString("单位名称")
此主题相关图片如下:qq截图未命名.jpg
还是有问题啊!
查看ComboBox2的属性,是不是已绑定了数据?
看看ExecuteReader返回的是不是nothing,也就是dt是不是nothing.