begin process at 2013 05 25 21:34:47
  Trouver un code source :
 
dans
 
Accueil > 

Tutoriels

 > 

Tutoriaux

 > connexion avec compte Utilisateur

connexion avec compte Utilisateur


 Information sur le tutoriel

Note :
Aucune note

 Description

petit codes juste pour l'authentification de l'utilisateur dans la base de données en entrant le nom dans un textboxutilisateur et le login dans un textboxpassword après avoir cliqué sur le boutton de la connexion bouttonconnexion

Tutorial

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);


}

}

}

}




Commentaires

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2013
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,312 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales