?
Solved

ASP/ADO bug with SQLserver

Posted on 1998-08-13
4
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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.
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

764 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