Solved

ASP/ADO bug with SQLserver

Posted on 1998-08-13
4
199 Views
Last Modified: 2010-03-19
Im creating a recordset from ASP with the following query (the recorset type is forward only, no lock, textual command);

SELECT *  FROM core WHERE empvis != null AND eNews=1

eNews is a bit datatype and empvis is datetime (with nulls) . When I run it from ASP, it returns nothing, yet running from the SQL tool in Enterprise manager it returns lots (what I want). If I remove the eNews=1 bit then I do get data returned via ASP. Is this an ADO bug - any workarounds?

Matthew Allum
0
Comment
Question by:matthewallum
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Wiz_of_Oz
ID: 1089546
what r the results of the qry
SELECT * FROM core
r they correct?
0
 

Author Comment

by:matthewallum
ID: 1089547
yep
0
 
LVL 4

Accepted Solution

by:
mitek earned 50 total points
ID: 1089548
Of course, it will return nothing. It's not a bug in ASP/ADO, but a bug in the query.
Instead of writing
SELECT *  FROM core WHERE empvis != null AND eNews=1 ,
try
SELECT *  FROM core WHERE empvis IS NOT null AND eNews=1

Your query is not supposed to return anything, because any comparison ( =, !=, >, <) to null will render FALSE value.
Thus, the whole expression is false and no rows are selected.
 
0
 

Author Comment

by:matthewallum
ID: 1089549
Thanks ! makes sense now and works ;)
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now