private Employee tdsEmp;
//Call this on your button click event
PopulateListFromTDS();
A table in a typed dataset is used to populate a list box with employee name from the employee table. A typed dataset provides design time verification of table names and field names before the program is run.
private void PopulateListFromTDS()
{
string s;
int i;
//Clear Items in listBox
lstResults.Items.Clear();
for(i=0;i<=tdsEmp.EmpTDS.Count - 1;i++) //EmpTDS is table
{
// Check to see if row is flagged deleted.
if (tdsEmp.EmpTDS.RowState != DataRowState.Deleted)
{
s = tdsEmp.EmpTDS.empName.ToString();
lstResults.Items.Add(s);
}
}
}
No comments:
Post a Comment