473,385 Members | 1,863 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,385 software developers and data experts.

How select from 2 ADO.NET DataTables?

Let's say I have 2 ADO.NET DataTables (tblAuthor and tblBook) within an
ADO.NET DataSet (dstPublish).

tblAuthor has DataColumns AuthorID and AuthorName, tblBook has DataColumns
BookID, BookTitle, AuthorID (assume a book can be written by only one
author).

tblAuthor

---------

1 Ayn

2 Jim

3 Sue

tblBook

-------

10 Fountainhead 1

11 Atlas Shrugged 1

12 Moby Dick 2

I want to create a list of all books with their associated author name.

FountainHead Ayn

Atlas Shrugged Ayn

Moby Dick

This is a breeze in SQL for me, but I'm not sure how to go about using
ADO.NET DataTables. Do I need a DataRelation, or is it just a matter of
having a for loop within a for loop, or is it something else?

Thanks,

Ron
Mar 10 '06 #1
1 1176
Ronald,

If there is a relation set, than you can use the childrows from the
tblAuthor

If there is no relation set, than you can set the AuthorID as a rowfilter in
the tblBook.defaultview (an inbuild dataview)

As well you can use the TableSelect with an expression.

The less work is that dataview method.

I hope this helps,

Cor

"Ronald S. Cook" <rc***@westinis.com> schreef in bericht
news:ei**************@TK2MSFTNGP11.phx.gbl...
Let's say I have 2 ADO.NET DataTables (tblAuthor and tblBook) within an
ADO.NET DataSet (dstPublish).

tblAuthor has DataColumns AuthorID and AuthorName, tblBook has
DataColumns BookID, BookTitle, AuthorID (assume a book can be written by
only one author).

tblAuthor

---------

1 Ayn

2 Jim

3 Sue

tblBook

-------

10 Fountainhead 1

11 Atlas Shrugged 1

12 Moby Dick 2

I want to create a list of all books with their associated author name.

FountainHead Ayn

Atlas Shrugged Ayn

Moby Dick

This is a breeze in SQL for me, but I'm not sure how to go about using
ADO.NET DataTables. Do I need a DataRelation, or is it just a matter of
having a for loop within a for loop, or is it something else?

Thanks,

Ron

Mar 10 '06 #2

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

Similar topics

2
by: Jade | last post by:
Hi, I just wanted to ask a quick question regarding datasets. I am creating 3 tables using a dataadapter. what i want to know is that is the relationship created between these datatables...
3
by: gh | last post by:
I have made the following stored procedure with the following select statement select * from user select * from order, orderdetail where order.id=orderdetail.id I know I can uses DataReader...
1
by: Harry V | last post by:
I'm wondering if there is a limit of a single select, delete and insert statement (command) to each dataadapter? On a form, I have a dataconnection that is shared by 3 dataadapters, one for each of...
2
by: Z D | last post by:
Hello, I'm currently using Remoting (HTTP/Binary) to remote a simple object. Everything is working fine except for one function that returns an arraylist of datatables. When I call this...
3
by: cj | last post by:
I've used datatables and datasets before. Datasets being able to hold more than one table and datatables being only one table. My mind keeps coming up with recordsets. I can't remember how they...
1
by: Ronald S. Cook | last post by:
Let's say I have 2 ADO.NET DataTables (tblAuthor and tblBook) within an ADO.NET DataSet (dstPublish). tblAuthor has DataColumns AuthorID and AuthorName, tblBook has DataColumns BookID,...
3
by: bbdobuddy | last post by:
Hi, I have two datatables that I want to left outer join and then do some queries on but I having a hard time figuring out how to join the datatables together. One of the datatables comes from...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
3
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= | last post by:
I'm not really sure how to ask this question because I'm still getting my feet wet with data access and VB.NET, but here goes: To start off with, I'm using VB 2005 Express to connect to an Access...
2
by: riltim | last post by:
Hi, I have a situation where I need to take multiple DataTables and convert them to a single Datatable which would be simple if I didn't need to convert them into a matrix where like items will...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.