Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB query problem 1

Status
Not open for further replies.

isha

MIS
Mar 7, 2002
216
IN
There is a table in SQL server database with a varchar type column named "disposed_off" with allow null permission.

At present there are only ten records in this table. in all these records the value of this column is <NULL>
But the following query is not showing any records.

rs.Open &quot;select * from ccomplaints where ccomplaints.disposed_off='&quot; & NULL & &quot;' or ccomplaints.disposed_off='&quot;&quot;' order by c_no,lodge_dt&quot;, con, adOpenDynamic, adLockOptimistic

Can someone tell me what is the problem.
Thanks.
 
do not use =&quot;null&quot; but = &quot;&quot;. That is an empty value. In your case &quot;null&quot; is being read as a value
 
I think this may work:

rs.Open &quot;select * from ccomplaints where ccomplaints.disposed_off IS NULL or ccomplaints.disposed_off='&quot;&quot;' order by c_no,lodge_dt&quot;, con, adOpenDynamic, adLockOptimistic

 
Actually thjis may be better

rs.Open &quot;select * from ccomplaints where ccomplaints.disposed_off IS NULL or ccomplaints.disposed_off='' order by c_no,lodge_dt&quot;, con, adOpenDynamic, adLockOptimistic

I missed the quotes combination first time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top