Click to See Complete Forum and Search --> : Does the SELECT statement return a value?


ZhiYi
June 5th, 2006, 09:54 PM
Hi,

I am setting up a user login account database. It consists of a table containg ID, username and password attributes.

First,the database will be searched to see if such a user exists.
What happens if the SELECT statement doesnt find a match? Does it return a value to indicate that there is no record found?

hspc
June 6th, 2006, 02:14 AM
No
An empty resultset will be returned

DanielaTm
June 6th, 2006, 02:56 AM
you could do it :
1. if you use sql server, an function ( for versions 2000 and up) or a stored procedure with out parameter to return let's say 1 if the user exists and 0 if does not exist, and in code treat it

2. a regular select statement, and in code to fill with the sql return set an dataset (.net) or recordset (vb) and look if the dataset/recordset has the count of records> or equal with 0

Hope it helped