For Answers, see/post comments

Data Relation between Two Different Datasets

Create Two Datacolumn variable for relating Two Tables in two different Datasets. Suppose you are having two tables Emp and Salary. EmpID is common for both the tables . Then Write the following coding to relate those tables

DataColumn dcEEmpID, dcSEmpID;
dcEEmpID= ds1.Tables["Emp"].Columns["EmpID "];
dcSEmpID= ds2.Tables["Salary"].Columns["EmpID "];

// Create the relationship between the two columnsDataRelation relEmpSal;
relEmpSal= new DataRelation("CustomerOrders", dcEEmpID, dcSEmpID);

No comments: