Hi,
I am using this code to populate data into combobox but i was just
thinking how can i assign an id to each item in the dropdown list like
the primary id for example because i want to save both id and name of
the company..
// fill the insurance company;
VDBAdapter.Sele ctCommand = new VistaDBCommand( "SELECT account_name AS
insurance_accou nt FROM accounts WHERE account_type = 'INSURANCE' ORDER
BY account_name", VDBConnection);
VDBDataset.Tabl es.Add("insuran ce_account");
VDBAdapter.Fill (VDBDataset, "insurance_acco unt");
//put the data from the dataset into the combobox
DataTable tblInsuranceCom pany = VDBDataset.Tabl es["insurance_acco unt"];
if (oDataTable == null)
throw new Exception("BoxC ustomers table not found in
oCustomersDataS et.");
foreach (DataRow oRow in tblInsuranceCom pany.Rows)
{
cboInsurance.It ems.Add(oRow["insurance_acco unt"]);
}
Many Thanks,
Jassim Rahma
*** Sent via Developersdex http://www.developersdex.com ***
I am using this code to populate data into combobox but i was just
thinking how can i assign an id to each item in the dropdown list like
the primary id for example because i want to save both id and name of
the company..
// fill the insurance company;
VDBAdapter.Sele ctCommand = new VistaDBCommand( "SELECT account_name AS
insurance_accou nt FROM accounts WHERE account_type = 'INSURANCE' ORDER
BY account_name", VDBConnection);
VDBDataset.Tabl es.Add("insuran ce_account");
VDBAdapter.Fill (VDBDataset, "insurance_acco unt");
//put the data from the dataset into the combobox
DataTable tblInsuranceCom pany = VDBDataset.Tabl es["insurance_acco unt"];
if (oDataTable == null)
throw new Exception("BoxC ustomers table not found in
oCustomersDataS et.");
foreach (DataRow oRow in tblInsuranceCom pany.Rows)
{
cboInsurance.It ems.Add(oRow["insurance_acco unt"]);
}
Many Thanks,
Jassim Rahma
*** Sent via Developersdex http://www.developersdex.com ***