using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace G_Sco_v1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=Sco;Integrated Security=True");
cn.Open();
SqlCommand cmd = new SqlCommand("select * from Users where username = '" + textBox1.Text + "' , and password ='" + textBox2.Text + "'", cn);
SqlDataReader dr;
dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
count += 1;
}
if (count == 1) {
MessageBox.Show("Bienvenue");
Form2 f2 = new Form2();
f2.Show();
}
else if (count > 0)
{
MessageBox.Show("Dupilicat Nom d'etulisateur ou mot de passe");
}
else {
MessageBox.Show("invalide Nom d'etulisateur ou mot de passe");
}
textBox1.Clear();
textBox2.Clear();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
[ATTACH]5329[/ATTACH]
bug.jpg