look at how it looks on sql when the server reads it..
through the textbox with no value:
select * from tbl_group_contact where userName ='NULL'
therefore it will select all usernames as there is no value to compare it against. So it compares nothing and selects everything
through select with no value:
select * from tbl_group_contact where userName =''
therefore it compares username to "".
The difference is that SQL understands NULL as an empty field and understands "" as a comparison.
The null will select everything and the "" will select only those fields where username does not equal null but does not have any information stored.
This is why validation is so detrimental in programming. A simple if isNull(Request.QueryString("txtName")) or Request.QueryString("txtName") = "" then statement can stop the SQL from firing and just show an error instead of tapping the database and getting distorted results.
Last edited by SheSaidImaPregy; Oct 20th, 2007 at 6:56 pm.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
Offline 1,080 posts
since Sep 2007