HELP - IF Statement and Stored Procedure
Posted on 2005-04-05
I'd like to set up a Stored Procedure so that when a user attempts to login, if no match is found it writes the variables to a Failed Logins table, but if a match is found, then rights the information to the Logins table.
For example...(I know this is wrong)
CREATE PROCEDURE sp_login
SELECT username, pass
WHERE username = @sUser AND pass=@sPass
If EXISTS BEGIN
INSERT INTO tlbLogins(username,pass,[date],ip)
INSERT INTO tblLoginsFailed(username,pass,[date],ip)
An afterthought (this might need to be a seperate question)....Right now I have my ASP checking to see if a match was found. If I have the Stored Procedure check to see if a match is found, how will I modify the Stored Procedure to return a value of successful or not successful to my ASP Script? Below is the current script I use (minus the modified Stored Procedure attempt above)
sSql = "sp_login'" & sUser & "','" & sPass &"','" & sIP &"'"
If Rs.EOF Then