473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

multiple relation in dataset

Hi there,

I have a dataset with two tables. They both have two columns which are
related (sort of a joined key). I know how to create one relation:

ds.Relations.Add("myrelation",
ds.Tables["authors"].Columns["au_id"],
ds.Tables["titles"].Columns["au_id"]);
How can I create a relation to the column "issue_number" in the same
relation? Or how do I approach this?

Thank you

Chris
Nov 17 '05 #1
1 5020
Depending on what you are trying to do, you can either create two separate
relations or you can use one of the DataRelation constructors that take
DataColumn arrays as parameters like this:

ds.Relations.Add("myrelation", new DataColumn[] {

ds.Tables["Authors"].Columns["au_id"],

ds.Tables["Authors"].Columns["issue_number"] },

new DataColumn[] {

ds.Tables["Titles"].Columns["au_id"],

ds.Tables["Titles"].Columns["issue_number"] });

HTH

Dale Preston
MCAD, MCDBA, MCSE

"chris" <ch***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
Hi there,

I have a dataset with two tables. They both have two columns which are
related (sort of a joined key). I know how to create one relation:

ds.Relations.Add("myrelation",
ds.Tables["authors"].Columns["au_id"],
ds.Tables["titles"].Columns["au_id"]);
How can I create a relation to the column "issue_number" in the same
relation? Or how do I approach this?

Thank you

Chris

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Julio Sarmiento | last post by:
Can anyone help me???? I have a table that I need to get the sum of four individual fields and then rank them from highest to lowest total. After summing up the four fields individually and...
1
by: Brian | last post by:
I have a dataset containing 2 tables. I need to fill a datagrid using data from both of these. If I could create a SQL Statement to fill the datagrid, it would look like this: SELECT...
7
by: Wayne Brantley | last post by:
I have found what appears to be an error in streaming with Datasets. It causes an error of 'Cannot find relation 0' when recreating the dataset from a stream. Here is how you reproduce it. ...
12
by: Peter Proost | last post by:
Hi group, has anyone got any suggestions fot the best way to handle this problem, I've got 3 tables for example table A, B, and C table A looks like name, value table B looks like name, value...
5
by: Corno | last post by:
Hi all, If I want to provide a typed dataset from a webservice and if that dataset has relations that are nested (isNested=True), then the relations(keyrefs) are not available in the XSD that is...
4
by: Robert Bravery | last post by:
Hi all, I have now correctly set up my dataset and two grids, so that the parent navigates the child. THe thing is that the child table is actually a lookup type table. It lists billing types for...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
0
by: ~J~ | last post by:
Hi, I really hope someone can help me out here. In relation to this thread ( http://www.thescripts.com/forum/thread349557.html ) I'm having a similar issue and getting nowhere fast! In a...
1
by: Andrea | last post by:
I have a data structure composed with a dataset with multiple tables connected through relationship. I'm using different table adapters of the dataset for load table, but when i use the select...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.