I have a SQL Server 2008 database and I am working on it in the backend. I am working on asp.net/C#
using (SqlCommand StrQuer = new SqlCommand("SELECT * FROM [shopcart].[dbo].[user] WHERE username=@userid AND password=@password", myconn))
{
StrQuer.Parameters.AddWithValue("@userid", str_usr);
StrQuer.Parameters.AddWithValue("@password", str_psd);
SqlDataReader dr = StrQuer.ExecuteReader();
if (dr.HasRows)
{
// MessageBox.Show("loginSuccess");
}
}
I know that the reader has values. My SQL command is to select just 1 row from a table. I want to read the items in the row in the reader one by one. How do I do this?
Thanks