public Boolean RegistrarCurso(Curso objeto) { try { conexion = cn.conectar(); cmd = new SqlCommand("RegistrarCurso", conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@nombreCurso", SqlDbType.VarChar, 50)); cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar, 50)); cmd.Parameters.Add(new SqlParameter("@creditos", SqlDbType.Int)); cmd.Parameters["@nombreCurso"].Direction = ParameterDirection.Input; cmd.Parameters["@email"].Direction = ParameterDirection.Input; cmd.Parameters["@creditos"].Direction = ParameterDirection.Input; cmd.Parameters["@nombreCurso"].Value = objeto.Nombre_c; cmd.Parameters["@email"].Value = objeto.Correro_c; cmd.Parameters["@creditos"].Value = objeto.Credito_c; conexion.Open(); cmd.ExecuteNonQuery(); return(true); } catch (Exception ex) { errores = ex.Message; return(false); } finally { if (conexion.State == ConnectionState.Open) { conexion.Close(); } conexion = null; cmd = null; cn = null; } }