PC Review


Reply
Thread Tools Rate Thread

Data Relations

 
 
Ken
Guest
Posts: n/a
 
      15th Jul 2003
Has anyone created a data relation that consists of two concatenated fields
for parentCol and childCol instead of one as in this Miscrsoft example in
C#?

private void CreateRelation() {
// Get the DataColumn objects from two DataTable objects in a DataSet.
DataColumn parentCol;
DataColumn childCol;
// Code to get the DataSet not shown here.
parentCol = DataSet1.Tables["Customers"].Columns["CustID"];
childCol = DataSet1.Tables["Orders"].Columns["CustID"];
// Create DataRelation.
DataRelation relCustOrder;
relCustOrder = new DataRelation("CustomersOrders", parentCol, childCol);
// Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder);
}


I posted this in another forum by accident.


 
Reply With Quote
 
 
 
 
Burton Roberts
Guest
Posts: n/a
 
      16th Jul 2003
Why concatenate the fields? Just define the parent and child as datacolumn
arrays and, assign the columns to the appropriate array members. (I'm a VB
guy, so excuse if I make a silly error)

DataColumn[] parentCol;
DataColumn[] childCol;

parentCol[0] = DataSet1.Tables["Customers"].Columns["CustID"];
parentCol[1] = DataSet1.Tables["Customers"].Columns["OtherColumn"];

childCol[0] = DataSet1.Tables["Orders"].Columns["CustID"];
childCol[1] = DataSet1.Tables["Orders"].Columns["OtherColumn"];
DataRelation relCustOrder;
relCustOrder = new DataRelation("CustomersOrders", parentCol, childCol);
DataSet1.Relations.Add(relCustOrder);





"Ken" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Has anyone created a data relation that consists of two concatenated

fields
> for parentCol and childCol instead of one as in this Miscrsoft example in
> C#?
>
> private void CreateRelation() {
> // Get the DataColumn objects from two DataTable objects in a DataSet.
> DataColumn parentCol;
> DataColumn childCol;
> // Code to get the DataSet not shown here.
> parentCol = DataSet1.Tables["Customers"].Columns["CustID"];
> childCol = DataSet1.Tables["Orders"].Columns["CustID"];
> // Create DataRelation.
> DataRelation relCustOrder;
> relCustOrder = new DataRelation("CustomersOrders", parentCol,

childCol);
> // Add the relation to the DataSet.
> DataSet1.Relations.Add(relCustOrder);
> }
>
>
> I posted this in another forum by accident.
>
>



 
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
Data Relations In ASP.net Dave Hagerich Microsoft ASP .NET 0 3rd Oct 2005 06:40 PM
ACCESS relations: table clones doesn't keep relations =?Utf-8?B?U3VwZXJib3k=?= Microsoft Access 1 19th Jul 2005 10:57 PM
data relations Joe Van Meer Microsoft ASP .NET 4 5th May 2004 07:57 PM
Data Relations and i`ll even pay someone now to tell me! Merlin Microsoft VB .NET 4 3rd Mar 2004 03:28 PM
Need help with data relations Pierre Microsoft ADO .NET 0 27th Oct 2003 02:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:21 AM.