data reader
I'm trying to match a UserID and Password from existing database using Data Reader and if no match shoe message and validating the information on the return
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Khargesh RajputPosted Apr 8, 2015, 11:53 PM
Sample for fetch data is like
SqlCommand command = new SqlCommand(
"SELECT * FROM login where username=@uname and password=@pwd;",
connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
//login success
}
else
{
//invalid login
}
Akhil GargPosted Apr 8, 2015, 10:47 PM