I have this code:
cmd.Parameters.AddWithValue("@userName", txtLoginUserName.Text.Trim());
cmd.Parameters.AddWithValue("@password", txtLoginPassword.Text.Trim());
string sqllogin = "SELECT [username],[password] FROM users WHERE ([username] = @userName AND [password] = @password) ";
try
{
con.Open();
cmd.CommandText = sqllogin;
int store = cmd.ExecuteNonQuery();
con.Close();
Label4.Text = store.ToString();
}
catch (Exception ex)
{
con.Close();
}
Whenever it executes, it prints out 0
in label4
. Is that the correct way to check how many rows are returned?