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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: ASP.net and SQL server - login help

Status
Not open for further replies.
Jun 25, 2006
25
US
A tutorial would be great (everything i found was for Access or MYSQL which caused errors). I have no clue what i am doing. First off, tell me if this will work, or if i'm going at this the wrong way...

I have an SQL database with a customers table. Attributes include: username and password.

I have a login.aspx page with two text boxes - txtUsername/txtPassword (for username and password verification) and a button to submit - btnSubmit.

What code do i put on the submit botton or aspx page?
How do i search the Customers table to see if they have a valid username/password?
Do i need code for a stored procedure - sql query?
And once the user is verified, how do i automatically redirect them to the protected page? Example: members.aspx


 
Add a dataset to your page, create a table adapter called Login for example that will select userid maybe from your login table and give it 2 variables ie.

Select * from Users where username=@username and password=@password

then you can use that query on your button click event

dim dt as new DatasetName.LoginDataTable
dim da as new LoginTableAdapters.LoginTableAdapter

dt = da.Login(txtUserName,txtPassword)

if dt.rows.count > 0 then
response.redirect("somepage.aspx")
endif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top