public void ModificaComment(int id, string text, int codActividad, string codUser, DateTime date)
{
string comando = "UPDATE [Comentario] SET texto = '" + text + "', actividad = '" +
codActividad + "', usuario = '" + codUser + "', fecha = '" + date.ToString("yyyy-MM-dd HH:mm:ss") + "' WHERE id = '" + id + "'";
SqlConnection c = null;
SqlCommand comandoTBD;
try
{
c = new SqlConnection(conexionTBD);
comandoTBD = new SqlCommand(comando, c);
c.Open();
comandoTBD.CommandType = CommandType.Text;
comandoTBD.ExecuteNonQuery();
}
catch (SqlException)
{
throw;
}
finally
{
if (c != null) c.Close(); // Se asegura de cerrar la conexión.
}
}