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