How you will set the datarelation between two columns?

Answers were Sorted based on User's Feedback



How you will set the datarelation between two columns?..

Answer / swapna

ADO.NET provides DataRelation object to set relation
between two columns.It helps to enforce the following
constraints,a unique constraint, which guarantees that a
column in the table contains no duplicates and a foreign-
key constraint,which can be used to maintain referential
integrity.

A unique constraint is implemented either by simply setting
the Unique property of a data column to true, or by adding
an instance of the UniqueConstraint class to the
DataRelation object's ParentKeyConstraint.

As part of the foreign-key constraint, you can specify
referential integrity rules that are applied at three
points,when a parent record is updated,when a parent record
is deleted and when a change is accepted or rejected.

Is This Answer Correct ?    3 Yes 0 No

How you will set the datarelation between two columns?..

Answer / 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

How you will set the datarelation between two columns?..

Answer / ganesh

the only option is foreign key

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ADO.NET Interview Questions

What is openrowset?

0 Answers  


what is connection pooling ?

3 Answers   Vertex,


what are the differences between dataset and datareader?

4 Answers   Choice Solutions,


Which parameter of ConnectionString is used to specify the name of the database?

0 Answers  


What are the Different layers in ADO.Net?

10 Answers   eXensys,






What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

0 Answers  


What is the difference in record set and dataset?

0 Answers  


What is the difference between a datareader and a dataset?

0 Answers  


What is connection in ado.net?

0 Answers  


Whate are different types of Commands available with DataAdapter ?

2 Answers  


Sequence to connect and retrieve data from database useig dataset ?

6 Answers   MMTS,


What is difference between ado.net and asp net?

0 Answers  


Categories