probleme select dans procedure stockée
Bonjour,
Je dois vraiment être le boulet du mois, mais j'ai encore un problème avec une procédure stockée.
ma procedure est sensée me retourner l'id du client dont j'ai introduit le nom.
En soit rien de compliqué en sql.
Mais j'ai toujours 0 est-ce ma procédure qui est mauvaise ou mom code ?
Je ne sais pas trop .
voici déja le code c#
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
| public int SelectIdClient(string nomClient )
{
this.Connection.ConnectionString = this.ConnectionStr;
this.Connection.Open();
// insere un nouveau client vide et récupère son id
MySqlCommand cmd = this.Connection.CreateCommand();
cmd.CommandText = "searcheidclient";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@lenomducontact",nomClient);
MySqlParameter outParam = new MySqlParameter("@LEIDClient", MySqlDbType.Int32);
outParam.Direction = ParameterDirection.Output;
cmd.Parameters.Add(outParam);
int res=cmd.ExecuteNonQuery();
if (res != 0)
{
int newIdClient = (int)outParam.Value;
return newIdClient;
}
else
{
return 0; |
et voici la procédure qui tourne dans mysql
Code:
1 2 3 4
|
BEGIN
select idClient FROM clients where nomClient = Lenomducontact INTO LEIDClient;
end |
Encore une fois je vous remercie de votre aide.