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

Define ado.net?

0 Answers  


What is data access pattern?

0 Answers  


How can you add or remove rows from the datatable object of dataset?

0 Answers  


how to add a selected row of a gridview to another gridview without reloading the page??

2 Answers  


how you will deal result set? How do you sort a dataset?If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?

0 Answers  






Which is the best method to get two values from the database?

0 Answers  


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

0 Answers  


What is a serialized object?

0 Answers  


Define isolation?

0 Answers  


What is ado.net explain with diagram?

0 Answers  


What do you know about ado.net's objects?

0 Answers  


If i am expecting a single result from sqlserverdatabase then what command should i follow ?sqlcommand.executereader (commandbehaviour.singleresult)or sqlcommand.executescalar()

4 Answers  


Categories