Solved

ASP/ADO bug with SQLserver

Posted on 1998-08-13
4
195 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

708 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

14 Experts available now in Live!

Get 1:1 Help Now