PC Review


Reply
Thread Tools Rate Thread

Create DataSet relation with more than 1 field

 
 
Tim Kelley
Guest
Posts: n/a
 
      9th Jan 2007
I have two tables that are linked by 2 fields (ID1 and ID2). Is it possible
to create this relation once the tables are in a DataSet? I can create a
relation using a single field, but I don't know if this is possible with
multiple fields.

Thanks,



 
Reply With Quote
 
 
 
 
Karthik D V
Guest
Posts: n/a
 
      10th Jan 2007

Tim Kelley wrote:
> I have two tables that are linked by 2 fields (ID1 and ID2). Is it possible
> to create this relation once the tables are in a DataSet? I can create a
> relation using a single field, but I don't know if this is possible with
> multiple fields.
>
> Thanks,


Hi,
This is how you can do .... I have given code snippet. I think
this will be useful for your problem.

DataSet ds;
DataTable dt1;
DataTable dt2;
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
DataRelation dr1 = new DataRelation("ID1 RELATION",
"PARENTID1", "CHILDID1");
dr1.ParentTable = dt1;
dr1.ChildTable = dt2;
DataRelation dr2 = new DataRelation("ID2 RELATION",
"PARENTID2", "CHILDID2");
dr2.ParentTable = dt1;
dr2.ChildTable = dt2;
ds.Relations.Add(dr2);

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet 1 to many Relation - How to? =?Utf-8?B?U2hhcm9u?= Microsoft C# .NET 14 15th Jun 2005 08:01 AM
Dataset relation on more than one column MikeL Microsoft ADO .NET 0 11th Mar 2005 05:52 PM
Create Dataset with a Binary Field? Alejandro K. Microsoft ADO .NET 2 19th Nov 2003 03:44 PM
Re: question about DataSet & Relation Lloyd Dupont Microsoft ADO .NET 0 30th Oct 2003 03:52 AM
Re: Dataset Relation Rebecca Riordan Microsoft ADO .NET 0 11th Jul 2003 03:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 AM.