using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Data.SqlClient;
using System.Text;
using System.Configuration;
using System.Data.Sql;
using System.Data.OleDb;
using System.Windows.Forms;
namespace CLIENT
{
public partial class COMPTE_UTILISATEUR : Form
{
OleDbConnection cnn;
OleDbCommand cmd;
DataSet ds = new DataSet();
OleDbDataAdapter da;
public COMPTE_UTILISATEUR()
{
InitializeComponent();
string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\TRAVAILMINDONGO\CLIENT\CLIENT\TFCGESTIONMINDONGOKANIKI.accdb";
cnn = new OleDbConnection(connectionString);
}
private void form1_load(object sender, EventArgs e)
{
lecture();
}
void lecture()
{
cmd = new OleDbCommand("SELECT * FROM COMPTE", cnn);
da = new OleDbDataAdapter(cmd);
}
private void buttonconnexion_Click(object sender, EventArgs e)
{
try
{
string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\TRAVAILMINDONGO\CLIENT\CLIENT\TFCGESTIONMINDONGOKANIKI.accdb";
cnn = new OleDbConnection(connectionString);
//Authentification de l'utilisateur
cmd = new OleDbCommand("SELECT COUNT(*) FROM compte WHERE utilisateur = '" + textBoxUTILISAT.Text + "' AND passe = '" + textBoxPASSWORD.Text + "'", cnn);
OleDbCommand Checkuser = new OleDbCommand();
cnn.Open();
int temp = System.Convert.ToInt32(cmd.ExecuteScalar().ToString());
if (temp == 1)
{
cmd = new OleDbCommand(" select * from COMPTE where UTILISATEUR='" + textBoxUTILISAT.Text + "' AND PASSE='" + textBoxUTILISAT.Text + "' ", cnn);
{
MENU_GENERALE MGT = new MENU_GENERALE();
MGT.Show();
this.Hide();
}
}
else
{
MessageBox.Show("Ecrivez corretement votre nom ou le mot de passe", "Erreur de Compte Utilisateur", MessageBoxButtons.OK, MessageBoxIcon.Stop);
textBoxUTILISAT.Text = "";
textBoxPASSWORD.Text = "";
textBoxUTILISAT.Focus();
}
cnn.Close();
}
catch (Exception REX2KING)
{
MessageBox.Show(REX2KING.Message);
}
}
}
}