I am trying to make a login form using SQLite database, i have created a new table named login, i have added id (pk), username and password fields (both username and password are texts as data type) and i wrote the following code:
conn.Open();
SQLiteCommand cmd = new SQLiteCommand("select * from login where username = '"+textbox_id.Text+"' and password ='"+textbox_password.Text+"'", conn);
cmd.ExecuteNonQuery();
SQLiteDataReader dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("K");
}
I have tried to use parameters but its the same result, nothing happens, no error but count is not incremented for some unknown reason.
Aucun commentaire:
Enregistrer un commentaire