以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]突然发现的错误,日期选择框代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=46026) |
-- 作者:红颜 -- 发布时间:2014/2/15 19:04:00 -- [求助]突然发现的错误,日期选择框代码 下面是日期输入框ValueChanged事件代码 Dim lst As WinForm.ComboBox = e.form.Controls("ComboBox1") lst.items.Clear e.Form.Controls("ComboBox1").Value = "" Dim rq As String = e.form.Controls("DateTimePicker1").Value Dim cmd As New SQLCommand Dim dt As DataTable cmd.CommandText = "SELECT DISTINCT BRXM From {SFMX} Where RQ = #" & rq & "#" dt = cmd.ExecuteReader e.Form.Controls("ComboBox1").Combolist = dt.GetComboListString("BRXM")
|
-- 作者:y2287958 -- 发布时间:2014/2/15 19:23:00 -- ValueChanged事件要加个判断是否空值 |
-- 作者:有点甜 -- 发布时间:2014/2/15 19:31:00 -- 如2楼,这样改一下 Dim lst As WinForm.ComboBox = e.form.Controls("ComboBox1") lst.items.Clear e.Form.Controls("ComboBox1").Value = "" Dim rq As String = e.form.Controls("DateTimePicker1").Value Dim cmd As New SQLCommand Dim dt As DataTable If rq > "" Then cmd.CommandText = "SELECT DISTINCT BRXM From {SFMX} Where RQ = #" & rq & "#" Else cmd.CommandText = "SELECT DISTINCT BRXM From {SFMX}" End If dt = cmd.ExecuteReader e.Form.Controls("ComboBox1").Combolist = dt.GetComboListString("BRXM") |