Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
this question should not have any data connection in it.and the tables should be inserted in the dataset itself.
Posted

1 solution

How to create dataset:-
DataSet dsCustomer= new DataSet();


1,480,000 results on create dataset in ado.net

Create Two DataTables:-
DataTable customersMast = dsCustomer.Tables.Add("CustomersMaster");
DataTable customersDet = dsCustomer.Tables.Add("CustomersDetails");


1,030,000 results on create datatable in ado.net

Relationship between two datatables:-

ForeignKeyConstraint custOrderFK = new ForeignKeyConstraint("CustOrderFK",
custDS.Tables["CustTable"].Columns["CustomerID"], 
custDS.Tables["OrdersTable"].Columns["CustomerID"]);
custOrderFK.DeleteRule = Rule.None;  
// Cannot delete a customer value that has associated existing orders.
custDS.Tables["OrdersTable"].Constraints.Add(custOrderFK);


Please don't forget to mark this as your answer if it helps you out.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900