以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]从内部数据源生成列表项目? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=29024) |
-- 作者:红颜 -- 发布时间:2013/2/26 8:29:00 -- [求助]从内部数据源生成列表项目? 例如窗口,可以在窗口的AfterLoad事件设置代码:
Dim cmd As New SQLCommand
Dim dt As DataTable cmd.C cmd.CommandText = "SELECT DISTINCT XM From (明细表)" dt = cmd.ExecuteReader e.Form.Controls("Comboox1").Combolist = dt.GetComboListString("客户名称") Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "SELECT DISTINCT XM From (明细表)" dt = cmd.ExecuteReader e.Form.Controls("Comboox1").Combolist = dt.GetComboListString("客户名称")
按上述代码,不能从内部数据源生成列表项目。 [此贴子已经被作者于2013-2-26 8:30:41编辑过]
|
-- 作者:红颜 -- 发布时间:2013/2/26 8:32:00 --
Dim cmd As New SQLCommand C
Dim dt As DataTable cmd.C cmd.CommandText = "SELECT DISTINCT XM From (明细表)" [此贴子已经被作者于2013-2-26 8:33:34编辑过]
|
-- 作者:lin_hailun -- 发布时间:2013/2/26 8:32:00 -- 对于内部表,不需要写数据源的名字的,如下代码。 Dim cmd As New SQLCommand Dim dt As DataTable cmd.CommandText = "SELECT DISTINCT XM From (明细表)" dt = cmd.ExecuteReader e.Form.Controls("Comboox1").Combolist = dt.GetComboListString("客户名称") |
-- 作者:红颜 -- 发布时间:2013/2/26 9:05:00 -- 以下是引用lin_hailun在2013-2-26 8:32:00的发言:
对于内部表,不需要写数据源的名字的,如下代码。 Dim cmd As New SQLCommand Dim dt As DataTable cmd.CommandText = "SELECT DISTINCT XM From (明细表)" dt = cmd.ExecuteReader e.Form.Controls("Comboox1").Combolist = dt.GetComboListString("客户名称") 谢谢指点迷津!正确 |