Salve, ho un problema nella creazione di una stored procedure che voglio creare da un applicazione c#: il codice è il seguente:
codice:
 objSqlConnection = new MySqlConnection(strConnection);
            objSqlConnection.Open();
            string strSQL = null;
            MySqlCommand SqlCommand = new MySqlCommand();
       
          SqlCommand.CommandText = "USE getroto;\n" +
                                   "DELIMITER $$;\n" +
                                   "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;";
 
            SqlCommand.CommandType = CommandType.Text;
            SqlCommand.Connection = objSqlConnection;
            SqlCommand.ExecuteNonQuery();
quando viene eseguito la stored procedure non viene creata e mi da in output il messaggio:
Eccezione first-chance di tipo 'MySql.Data.MySqlClient.MySqlException' in MySql.Data.dll.

Non riesco a capire dove sbaglio, altri comandi tipo "drop procedure `getroto`.`Schede2`" o "create table" vengono esguiti senza errore alcuno!
Grazie in anticipo x qualsiasi suggerimento.