public void BorrarComment(int id)
{
SqlConnection c = null;
string comando = "DELETE FROM [Comentario] WHERE id= '" + id + "'";
try
{
c = new SqlConnection(conexionTBD);
c.Open();
SqlCommand cmd = new SqlCommand(comando, c);
cmd.ExecuteNonQuery();
}
catch (SqlException)
{
throw;
}
finally
{
if (c != null) c.Close(); // Se asegura de cerrar la conexión.
}
}
public void Borrar() { CADComentario mens = new CADComentario(); mens.BorrarComment(id); }