1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.OleDb;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form3 : Form
{
OleDbConnection con = new OleDbConnection(Program.con);
public Form3()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == string.Empty & textBox2.Text == string.Empty)
{
MessageBox.Show("Veuiller saisir Votre Nom et Votre Mots de Passe SVP!");
}
else
{
con.Open();
OleDbDataAdapter sda = new OleDbDataAdapter("select count(*) from USER where COMPTE='" + textBox1.Text+"' and PASSE='" + textBox2.Text + "'", con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows[0][0].ToString() =="1")
{
MessageBox.Show("Vous êtes connecté");
Form3 myForm1 = new Form3();
Form1 myForm2 = new Form1();
this.Hide();
myForm2.Show();
}
else
{
MessageBox.Show("Votre Nom ou votre mots de passe est incorrecte");
}
con.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
} |
Partager