Précédent   Forum du club des développeurs et IT Pro > Dotnet > Langages > C#
C# Forum d'entraide sur la programmation C#. Avant de poster -> FAQ C#, Articles C#, Sources C#
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 08/01/2013, 14h00   #1
dharkan
Membre régulier
 
Développeur informatique
Inscription : mars 2010
Messages : 187
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : mars 2010
Messages : 187
Points : 74
Points : 74
Par défaut Lecture de SqlDataReader

Bonjours j'essaye de lire un SqlDataReader
mais je n'arrive pas à accéder aux membre du reader.
Lorsque j execute ma procedure stockée sous SQL server,
celle-ci me renvoie bien la row dont j ai besoin voici le code de lecture du
SqlDataReader :

Code :
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
 
public static bool AuthentificationUtilisateur(string login, string mp)
        {
            bool estConnecter = false;
 
            string loginCrypt = string.Empty;
            string mpCrypt = string.Empty;
 
            using (MD5 crypt = MD5.Create())
            {
                loginCrypt = Cryptage(login, crypt);
                mpCrypt = Cryptage(mp, crypt);
            }
            using (SqlConnection connexion = new SqlConnection(ChaineConnexion))
            {
                using (SqlCommand command = new SqlCommand("SP_SelectUtilisateur", connexion))
                {
                    command.CommandType = CommandType.StoredProcedure;
 
                    command.Parameters.Add("@login", SqlDbType.VarChar).Value = loginCrypt;
                    command.Parameters.Add("@password", SqlDbType.VarChar).Value = mpCrypt;
 
                    connexion.Open();
                    SqlDataReader reader = command.ExecuteReader();
 
                    while (reader.Read())
                    {
 
                        if (reader["Login"].ToString() == loginCrypt && reader.["Password"].ToString() == mpCrypt)
                        {
                            estConnecter = true;
                        }
                    }
                }
            }
            return estConnecter;
        }
dharkan est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/01/2013, 16h58   #2
infosam76
Membre Expert
 
Homme Eric Metz
Développeur informatique
Inscription : avril 2006
Messages : 515
Détails du profil
Informations personnelles :
Nom : Homme Eric Metz
Âge : 36
Localisation : Belgique

Informations professionnelles :
Activité : Développeur informatique
Secteur : Santé

Informations forums :
Inscription : avril 2006
Messages : 515
Points : 1 601
Points : 1 601
Quand vous dites que vous n'arrivez pas à y accéder, vous avez un message d'erreur ou autre chose ?
infosam76 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 16h33.


 
 
 
 
Partenaires

Hébergement Web