爱问知识人 爱问教育 医院库

vb中的查询问题

首页

vb中的查询问题

我建了一张表,车位号、业主号、车位位置、车位状态,我想通过一个按钮找出业主号为空的车位号,用Vb怎么实现,我每次显示都是没有记录的,可是我 把表里所有的业主号都置空还是没有相应的记录!!请各位帮忙!
部分代码如下
     id= "Select * from proprietors where proprietorsID='" & "" & "'"
     Adodc2.RecordSource = id
     Adodc2.CommandType = adCmdText                     
     Adodc2.Refresh
     DataGrid2.Refresh

提交回答
好评回答
  • 2019-03-23 18:10:15
    Select * from proprietors where proprietorsID='" & "" & "'" 
    部分,对于查询值是要用Is Null或Not Is Null的.
    此部分应该修改为:
    Select * from proprietors where proprietorsID is null or proprietorsID=''
    这样一来可以查询到,同时可以查询到空字符串的值
    

    凯***

    2019-03-23 18:10:15

其他答案

    2019-03-23 18:19:39
  • 代码中未见Adodc2.ConnectionString的设置.例:
    Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\cartemp.mdb;Persist Security Info=False"
    你代码中下句是多余的:
    Adodc2.CommandType = adCmdText 

    慧***

    2019-03-23 18:19:39

  • 2019-03-23 17:32:18
  • 空用null试试
    proprietorsID=null

    杨***

    2019-03-23 17:32:18

类似问题

换一换

相关推荐

正在加载...
最新资料 推荐信息 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 172-191
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):