procedure stockée sur mysql cannot be found
Bonjour,
J'essaye d'utiliser un procedure stockée sur une base de donnée mysql.
Mais j'ai un message d'erreur le voici :
Citation:
Procedure or function 'AddClient' cannot be found in database 'MailTo'.
pourtant j'ai bien créé un procédure AddClient.
pouvez vous me guider afin que j'arrive à utiliser cette procédure.
Voici ma procedure
Code:
1 2 3 4 5 6 7
|
DELIMITER |
CREATE PROCEDURE AddClient (OUT IDClient INT(32))
BEGIN
INSERT INTO clients(nomClient) VALUES('nouveauclient');
SELECT LAST_INSERT_ID() INTO IDClient;
END| |
lorsque je fais via la console mysql
Code:
1 2
| ( call Addclient(@monid);
puis select @monid |
ça fonctionne. donc la procédure existe belle et bien
)
voici mon code csharp
Code:
1 2 3 4 5 6 7 8 9 10 11
|
this.MyAdapter.SelectCommand = new MySqlCommand(MySQLCmd, this.Connection);
this.Connection.ConnectionString = this.ConnectionStr;
this.OpenConnect(); // jusqu'ici j'ouvre ma connexion. suite à différents test et autre fonction je sais que la connexion s'ouvre bien.
MySqlCommand cmd = this.Connection.CreateCommand();
cmd.CommandText = "AddClient";
cmd.CommandType = CommandType.StoredProcedure;
MySqlParameter outParam = new MySqlParameter("@IDClient", MySqlDbType.Int32);
outParam.Direction = ParameterDirection.Output;
cmd.Parameters.Add(outParam);
cmd.ExecuteNonQuery(); |
Je vous remercie de votre aide.