public ModificaComment ( int id, string text, int codActividad, string codUser, System.DateTime date ) : void | ||
id | int | |
text | string | |
codActividad | int | |
codUser | string | |
date | System.DateTime | |
return | void |
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.
}
}
public void Modificar() { CADComentario mens = new CADComentario(); mens.ModificaComment(id,texto, actividadAcademica.Codigo, usuario.DNI, fecha); }