Exemplo n.º 1
0
 public override void Eliminar(ObjetoDelete od)
 {
     _command = new MySqlCommand(GenerarDeleteFrom(od), _connection);
     try
     {
         _connection.Open();
         _command.ExecuteNonQuery();
     }
     catch (MySqlException exc)
     {
         if (exc.Number == 547)
             throw new Exception("Existen relaciones hacia este elemento. Elimínelas y vuelva a intentarlo");
         else
         {
             throw new Exception("Mensaje: " + exc.Message + "\n\n" + "Consulta: " + _command.CommandText);
         }
     }
     finally
     {
         _connection.Close();
     }
 }
Exemplo n.º 2
0
 public string GenerarDeleteFrom(ObjetoDelete od)
 {
     string whereCadena = "";
     foreach (ValorWhere vw in od.ListaValoresWhere)
     {
         whereCadena += "(" + GenerarCondicion(vw) + ") and ";
     }
     whereCadena = RemoverUltimosCaracteres(whereCadena, 4);
     return string.Format("DELETE FROM {0} WHERE {1};", od.Tabla, whereCadena);
 }
Exemplo n.º 3
0
 public abstract void Eliminar(ObjetoDelete od);