Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请老师检查作业,动态列表项目,我又错哪了?

1楼
菜鸟foxtable 发表于:2009/1/13 9:02:00
ComboBox1的MouseEnter里有如下代码:

Dim cmd As New SQLCommand
cmd.Con nection Name = "zygl"这里故意留空格的.
Dim lst As WinForm.ComboBox
Dim dt As DataTable
cmd.CommandText = "Select 床位 From [住院登记] where 出院结账 = False"
dt = cmd.ExecuteReader()
lst = e.Form.Controls("ComboBox1")
lst.Items.clear
If dt.datarows.count >0 Then
For Each dr As Datarow In dt.Datarows
    lst.Items.Add(dr("床位"))
Next
End If

当住院登记表里所有行床位列都为空时报错......WHY?

图片点击可在新窗口打开查看此主题相关图片如下:001.jpg
图片点击可在新窗口打开查看
[此贴子已经被作者于2009-1-13 9:06:37编辑过]
2楼
czy 发表于:2009/1/13 12:16:00
加个判断吧。

Dim cmd As New SQLCommand
cmd.C
Dim lst As WinForm.ComboBox
Dim dt As DataTable
cmd.CommandText = "Select 床位 From [住院登记] where 出院结账 = False"
dt = cmd.ExecuteReader()
lst = e.Form.Controls("ComboBox1")
lst.Items.clear
If dt.datarows.count >0 Then
For Each dr As Datarow In dt.Datarows
    if dr("床位") IsNot  Nothing Then
       lst.Items.Add(dr("床位"))
    End If
Next
End If
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.