Populate list from typed dataset

Posted by Bubbly under C# category on | Views : 2762
First of all you need to define the typed dataset. For example, Here Employee is name of my xsd.
private Employee tdsEmp;

//Call this on your button click event

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
for(i=0;i<=tdsEmp.EmpTDS.Count - 1;i++) //EmpTDS is table
// Check to see if row is flagged deleted.
if (tdsEmp.EmpTDS[i].RowState != DataRowState.Deleted)
s = tdsEmp.EmpTDS[i].empName.ToString();

Comments or Responses

Login to post response