I'm trying to enable/disable my MySQL trigger from my C# program but allways show me the same Exception.
I also tried with SET @TRIGGER_CHECKS = FALSE
on cmd.CommandText
but I don't know how to do it because my program expect a parameter with that @
public void switchTriggerON()
{
conectar();
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "ALTER TRIGGER actualizacionCurso ENABLE;"; /DISABLE
cmd.Connection = conexion;
cmd.ExecuteNonQuery();
conexion.Close();
}
Exception: MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER actualizacionCurso DISABLE' at line 1 en MySql.Data.MySqlClient.MySqlStream.ReadPacket() en MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) en MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) en MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) en MySql.Data.MySqlClient.MySqlDataReader.NextResult() en MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) en MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() en ServidorConexion.Negocio.ConexionEnlaces.switchTriggerOFF() en D:\TFG\DAMnificus_Servidor\ServidorConexion\Negocio\ConexionEnlaces.cs:línea 487 en ServidorConexion.Negocio.ConexionEnlaces.cambiarCurso(String usuario, Int32 curso) en D:\TFG\DAMnificus_Servidor\ServidorConexion\Negocio\ConexionEnlaces.cs:línea 300 en ServidorConexion.Program.procesarPeticion(Peticion peticionActual, HttpListenerResponse response) en D:\TFG\DAMnificus_Servidor\ServidorConexion\Program.cs:línea 435
EDIT: WHAT I WANT IS DISABLE MY TRIGGER FROM C# CODE, NOT FROM MYSQL