How you will set the datarelation between two columns?
Answers were Sorted based on User's Feedback
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 |
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 |
What is disconnected scenario in entity framework?
What are advantages of microsoft-provided data provider classes in ado.net?
What are the Features and disadvantages of dataset
What is ole2 format?
Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?
Which keyword is used to accept variable number of parameters?
Being fresher How would i answer to the question that what is your salary exception?
How do you connect to sql server database without using sqlclient?
What are the drawbacks of using ado.net?
Does dapper use ado.net?
What is the use of connection object in ado.net?
0 Answers TryTechnicals Pvt Ltd,
What is the current version of entity framework?