VB.NET 2005如何判断空值

skidtren 2008-04-26 08:02:51
代码如下
Dim obj As Object = System.DBNull.Value
Dim sql As String = "select department1 from Information_System_department where dele_log='" + "S" + "' and company_id='" + s + " and department2='" + obj + "' "
sqlada = New SqlDataAdapter(sql, Me.sqlcon)
ds1 = New DataSet
ds1.Clear()
sqlada.Fill(ds1)

偶的department2的字段是空值.这样做查不出数据来.数据库中是有department2的字段是空值的(SQL中看到的是isnull)

高人指点一下什么改?
偶只有这么几分了
...全文
351 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuqingtong 2008-04-26
  • 打赏
  • 举报
回复
Dim sql As String = "select department1 from Information_System_department where dele_log='" + "S" + "' and company_id='" + s + " and ( isnull(department2,'') = '') "
vlsm 2008-04-26
  • 打赏
  • 举报
回复
Dim obj As string =""
hery2002 2008-04-26
  • 打赏
  • 举报
回复

Dim sql As String = "select department1 from Information_System_department where dele_log='" + "S" + "' and company_id='" + s + " and ( department2 is null or department2 ='') "

16,717

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧