1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
private void button1_Click(object sender, EventArgs e)
{
cn = new SqlConnection(ct);
cn.Open();
SqlDataAdapter sd = new SqlDataAdapter("Select Count(*) from connexion where login='" + textBox1.Text + "'and password='" + textBox2.Text + "'", cn);
DataTable dt = new DataTable();
sd.Fill(dt);
if (dt.Rows[0][0].ToString() != "0")
{
this.Hide();
form2 f = new form2();
f.Show();
cn.Close();
}
else
{
MessageBox.Show("Vérifier le login et le mot de passe");
cn.Close();
}
} |
Partager