i got a problem i have a registration and log in program
the registration is fine but on log-in ,
the 1st entry on registration is the only accessible on log in
i tried the 2nd and 3rd username with correct psw
but it got an error
heres my code
what should i add
pls message on face book
private void button2_Click(object sender, EventArgs e)
{
DbConnClass dc = new DbConnClass();
dc.ConnectIt();
MySqlConnection connection = new MySqlConnection(dc.MyConString);
MySqlDataAdapter da = new MySqlDataAdapter();
da.SelectCommand = new MySqlCommand("SELECT * FROM user1", connection);
da.SelectCommand.Parameters.Add("@username", SqlDbType.VarChar).Value = textBox1.Text;
da.SelectCommand.Parameters.Add("@password", SqlDbType.VarChar).Value = textBox2.Text;
connection.Open();
MySqlDataReader reader = null;
reader = da.SelectCommand.ExecuteReader();
reader.Read();
if (textBox1.Text == (reader["username"].ToString()) && textBox2.Text == (reader["password"].ToString()))
{
timer3.Enabled = true;
button1.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
}
else if ((textBox1.Text == "") || (textBox2.Text == ""))
{
MessageBox.Show("Please type a username/passsword", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Enter correct username/password");
textBox1.Clear();
textBox2.Clear();
textBox1.Focus();
}
connection.Close();
}