sqlstr="select top 1 XXX from table where id='"+trim(Combo1.List(Combo1.ListIndex))+"'and (XXXX is null or XXXX<>'')"
rs.open cn,sqlstr,1,3
if rs.eof then
'not empty
else
'empty
end if
sSQL="select * from tbl where bianhao='" & Combo1.text &"' and (XXXX is null or XXXX<>'')"
rs.open cn,sSQL,1,3
if rs.eof then
'not empty
else
'empty
end if
搞错:
Dim cn As New ADODB.Connection,rs As New ADODB.RecordSet
cn.ConnectionString="...."
cn.Open
rs.CursorLocation=adUseClient
rs.Open "select XXX字段 from 表 where 编号=' & Combo1.Text & "'"",cn,3,2
if Not rs.EOF then
if rs("XXX字段")="" then Msgbox "XXX字段为=""""
else
Msgbox "编号不存在!"
end if
Dim cn As New ADODB.Connection,rs As New ADODB.RecordSet
cn.ConnectionString="...."
cn.Open
rs.CursorLocation=adUseClient
rs.Open "select XXX字段 from 表 where 编号=' & Combo1.Text & "'"",cn,3,2
if Not rs.EOF then
Msgbox "XXX字段为空!"
else
Msgbox "编号不存在!"
end if
欲根据 combo1.text中的内容 “编号” 来查询数据库中 该编号的 XXX字段是否为""
--------------------------------
Dim cn As New ADODB.Connection,rs As New ADODB.RecordSet
cn.ConnectionString="...."
cn.Open
rs.CursorLocation=adUseClient
rs.Open "select XXX字段 from 表 where 编号=' & Combo1.Text & "'"",cn,3,2
if rs.Field(0).value="" then
msgbox "XXX字段为空!"
end if