Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login SQL Connection

Status
Not open for further replies.

drew10

Programmer
Feb 26, 2002
123
US
Hello all,
I am setting up a login page that uses the athentication and authorization in the web.config file. What I need to do is compare the login name and password to the existing name and password in a sql server db. What is the best method of doing this? With ExecuteScalar, DataSets or what? Any help would be of great assistance!
Thanks,
drew10
 
In an answer to my own question, I found some code on planetsourcecode.com that uses a:
While dataReader.Read()
boolean = true
End While
If boolean = true Then
authenticate
Else
message.text = "login incorrect"
End If

If anybody knows of a better way to handle it I'd love to know!
-drew10
 
If you're using sql server, your best bet might be to create a stored procedure that returns a boolean value. Pass the stored procedure the username and password, execute a select * from users where username = @Username and passwored = @Password, and if a record is found, return True. If not, return False.

Then deal with that answer in your code.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top