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

How can I retrieve two tables of data at a time by using data reader?

0 Answers  


what are the two key events for the sql connection class? explain the differnce between the two.

2 Answers   HCL, NIIT, Zensar,


What is method to get XML and schema from Dataset?

2 Answers  


What is bubbled event?

0 Answers  


What is ole2 format?

0 Answers  


What is the difference between a Dataset and DataReader? Can dataReader hold data from multiple tables?

3 Answers   Fulcrum Logic, Merrill Lynch,


What is disconnected data?

0 Answers  


How to find the count of records in a dataset?

6 Answers  


What is the difference between DataReader and DataSet in ADO.NET?

0 Answers   Petranics Solutions,


Explain the difference between sqlcommand object and command behavior object?

0 Answers  


What is full form of ado?

0 Answers  


Differentiate between Dataset and Recordset.

2 Answers  


Categories