I'm trying to create a login page.
I get the users ID and password as parameters, and I want to access my database and compare them, but when I execute the query using ExecuteReader
, the query always times out.
The database itself is very very small, only with about 5 or 6 users so it shouldn't be timing out......
SqlConnection cnn = null;
string connectionString = null;
connectionString = @"Data Source=DESKTOP-A5GR284\SQLEXPRESS;Initial Catalog=Chat_DB;Integrated Security=True";
cnn = new SqlConnection(connectionString);
cnn.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM Users", cnn);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.HasRows)
{
while (reader.Read())
{
Console.WriteLine("{0}", reader.GetString(1));
}
reader.NextResult();
}
cnn.Close();
The reader will timeout before entering the 'while loop'