0
I’m having a problem changing some information, in case I need to change two columns of a gridview, but they are coming directly from a database
I need to change these two fields(Id_category and Desc_category)
Form:
private void Mostrar()
{
this.datalista.DataSource = NCategoria.Mostrar();
}
Business layer
//Método Mostrar
public static DataTable Mostrar()
{
return new DCategoria().Mostrar();
}
Dice:
//metodo mostrar
public DataTable Mostrar()
{
DataTable DtResultado = new DataTable("categoria");
SqlConnection SqlCon = new SqlConnection();
try
{
SqlCon.ConnectionString = Conexao.Cn;
SqlCommand SqlCmd = new SqlCommand();
SqlCmd.Connection = SqlCon;
SqlCmd.CommandText = "spmostrar";
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sqlDat = new SqlDataAdapter(SqlCmd);
sqlDat.Fill(DtResultado);
}
catch
{
DtResultado = null;
}
return DtResultado;
}