MySQL Forums
Forum List  »  Quality Assurance

Error with CREATE PROCEDURE with C#
Posted by: Nic Mod
Date: February 07, 2012 05:13AM

Hello, i've a problem in creating a stored procedure in an c# application: this is the code:

objSqlConnection = new MySqlConnection(strConnection);
objSqlConnection.Open();
string strSQL = null;
MySqlCommand SqlCommand = new MySqlCommand();
SqlCommand.CommandText = "DELIMITER // " +
"USE getroto; " +
"CREATE DEFINER=`root`@`localhost` PROCEDURE `Schede2`() " +
"SQL SECURITY DEFINER " +
"BEGIN " +
"iF NOT EXISTS( " +
"SELECT * FROM information_schema.COLUMNS " +
"WHERE COLUMN_NAME='NrSoluzione' AND TABLE_NAME='schede' AND TABLE_SCHEMA='getroto' " +
") " +
"THEN " +
"ALTER TABLE `getroto`.`schede` " +
"ADD COLUMN `NrSoluzione` INT NULL DEFAULT '1' AFTER `UserLocked`; " +
"END IF; " +
"END // " +
"DELIMITER; ";
SqlCommand.CommandType = CommandType.Text;
SqlCommand.Connection = objSqlConnection;
SqlCommand.ExecuteNonQuery();


When the stored procedure is executed i get an output messagge:
first-chance exception of type 'MySql.Data.MySqlClient.MySqlException' in MySql.Data.dll.

The stored procedure is not created. i don't know what to do. Anybody can help me please?

Thanks a lot.

Options: ReplyQuote


Subject
Views
Written By
Posted
Error with CREATE PROCEDURE with C#
2216
February 07, 2012 05:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.