My problem is always in throw. please help me to find the problem. thanks!
MySqlConnection cnn = new MySqlConnection(mysqladdress);
cnn.Open();
try
{
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "SELECT * FROM info where StudentID ='" + textBox1.Text + "'and Name='" + textBox2.Text + "'";
MySqlDataReader reader = cmd.ExecuteReader();
int count = 0;
while (reader.Read())
{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("Welcome");
}
else if (count > 1)
{
MessageBox.Show("Access Denied");
}
else
{
MessageBox.Show("Wrong student ID and Password");
}
}
catch (Exception)
{
throw;
}