Jul 07, 2011, 7:40 PM
[SOLVED] store charge from a list object
hi
need, carry a store in a combobox from the object list,
the object was previously loaded from a DataReader,
but the need to include an item "null", need to load the list and then the store.
need, carry a store in a combobox from the object list,
the object was previously loaded from a DataReader,
but the need to include an item "null", need to load the list and then the store.
public void SecCod_carregadados(object sender, StoreRefreshDataEventArgs e){
cnxSecCod.abrirConexao();
cnxSecCod.comandos = new MySqlCommand("SELECT SecCod, SecDes FROM SECAO WHERE DEPCOD = @DEPCOD", cnxSecCod.conn);
cnxSecCod.comandos.Parameters.Add("@DEPCOD", DepCod.Value);
cnxSecCod.drlistagem = cnxSecCod.comandos.ExecuteReader();
List<object> listaseccod;
while (cnxSecCod.drlistagem.Read())
{
listaseccod = new List<object>
{
new {SecCod = int.Parse(cnxSecCod.drlistagem["SecCod"].ToString()), SecDes = cnxSecCod.drlistagem["SecDes"].ToString()}
};
if (cnxSecCod.drlistagem.Read() == false) {
SecaoStore.DataSource = listaseccod;
SecaoStore.DataBind();
}
}
cnxSecCod.fecharConexao();
Last edited by danilo; Jul 08, 2011 at 4:03 AM.