CAD.CADActividad.ModificaActividad C# (CSharp) Method

ModificaActividad() public method

public ModificaActividad ( string nombre, string desc, int cod, int codTurno ) : void
nombre string
desc string
cod int
codTurno int
return void
        public void ModificaActividad(string nombre,string desc,int cod,int codTurno)
        {
            string comando = "UPDATE [Actividad] SET nombre = '" + nombre + "', descripcion = '" + desc +"', codigoTurno = '" + codTurno + "' WHERE codigo = '" + cod + "'";
            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.
            }
        }