I am using visual studios 2010, and I have added a database and connected to it with SQLdatasource. I’m creating a basic login. I want the user to enter the login, and when he tries to login, I want to interate through the database and check if the login name exists.
How would I select just one column from the database and iterate through it.
I guess the select SQL statement will be
SELECT userName from tblUser
where username is column and tblUser is the table
You got the SQL statement right, at the end your SQLDataSource will look something like this:
Note: You may want to use a connection string located in your config file:
Also, you could also try to execute this query without using a SQLDataSource since it sounds like you will not be binding the result to a control. For example: