How you will set the datarelation between two columns?

Answer Posted / muthu kumar

DataSet d = new DataSet();
DataColumn parentDC = new
DataColumn(d.Tables["parentTable"].Columns["id"]);
DataColumn childDC = new
DataColumn(d.Tables["ChildTable"].Columns["id"]);
DataRelation ds = new DataRelation("relation name",
parentDC, childDC);
d.Relations.Add(ds);

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how to bind the controls(best practice) comboboxes to the data in the dataset?

558


How do you implement locking concept for dataset?

543


Explain how to copy the contents from one table to another table and how to delete the source table in ado.net?

456


Do we use stored procedure in ADO.Net?

574


What is ado code?

500






Which method is used to sort the data in ADO.Net?

1507


What are the usages of the command object in ado.net?

552


What is the difference between Optimistic and Pessimistic locking?

544


What is the DataTableCollection?

575


What is fill method in ado.net?

541


What is the use of data grid?

492


Explain which name space is used to get assembly details?

530


Which database is the ado.net sql connection object designed for?

592


What is disconnected data?

579


How to creating a SqlCommand Object?

591