Thatguy2001au
08-04-2003, 03:35 AM
Hi,
I am using a Function to call a Stored Procedure in SQL Server 2000 and passing it the variables - @Cuname and @Cupassword (ie: Cuname and Cupassword which are variables that have values takin fom a Form - Username and Password).
I want to select values in certain fields in a Table from the Database that I want returned depending on if the Username and Password match. I want to return the following:
customer_id
cfname
clname
cuername
cpassword
all from a CUSTOMERS table. If the username and password don't match, then i would like to return an error or some sort of variable so i can Tell that there was no match in the database.
Below is basically what i want to do, but i am unsure as to how to write up a stored procedure to make this work. If anyone can help me out, it would be greatly appreciated.
The reason I want the values returned is so I can then place them inside an array or cookie or something like that.
SELECT customer_id, cfname, clname, cusername, cpassword FROM CUSTOMERS WHERE cusername = @Cuname AND cpassword = @Cupassword
IF (@Cuname is NULL) OR (@Cuname = '') AND
(@Cupassword is NULL) OR (@Cupassword = '')
THEN
return and error
ELSE
return all the values which i can place in a cookie or Session Variable.
END IF
Thanks
I am using a Function to call a Stored Procedure in SQL Server 2000 and passing it the variables - @Cuname and @Cupassword (ie: Cuname and Cupassword which are variables that have values takin fom a Form - Username and Password).
I want to select values in certain fields in a Table from the Database that I want returned depending on if the Username and Password match. I want to return the following:
customer_id
cfname
clname
cuername
cpassword
all from a CUSTOMERS table. If the username and password don't match, then i would like to return an error or some sort of variable so i can Tell that there was no match in the database.
Below is basically what i want to do, but i am unsure as to how to write up a stored procedure to make this work. If anyone can help me out, it would be greatly appreciated.
The reason I want the values returned is so I can then place them inside an array or cookie or something like that.
SELECT customer_id, cfname, clname, cusername, cpassword FROM CUSTOMERS WHERE cusername = @Cuname AND cpassword = @Cupassword
IF (@Cuname is NULL) OR (@Cuname = '') AND
(@Cupassword is NULL) OR (@Cupassword = '')
THEN
return and error
ELSE
return all the values which i can place in a cookie or Session Variable.
END IF
Thanks