473,499 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about a dataset

Hi everyone,

I was wondering if it is possible, to use SQL to return more than one table
at a time into a dataset. I only know the basics of SQL and so I'm not sure
if I'm just asking a stupid question. But, I'm not proud! :-)

I'm using Ado.net and I'm wanting to load a DataSet object with several
independent tables. (For those who arent ADO.net programmers, a DataSet can
hold multiple tables and the relationships and contraints attached to
them. - Sort of like a mini-database as I understand it)

My question is - using SQL, will I have to execute several statements and
load the dataset manually, or is there some magic SQL command that I can use
to get more than one table back at once and magiacally into the dataset? I'm
using an access database so I can't use any stored procedures as I
understand it. Don't know of that makes any difference though.

Your advice as always is greatly appreciated.

Thanks

Simon
Nov 22 '05 #1
3 1931
Hi Simon,

"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi everyone,

I was wondering if it is possible, to use SQL to return more than one table at a time into a dataset. I only know the basics of SQL and so I'm not sure if I'm just asking a stupid question. But, I'm not proud! :-)

I'm using Ado.net and I'm wanting to load a DataSet object with several
independent tables. (For those who arent ADO.net programmers, a DataSet can hold multiple tables and the relationships and contraints attached to
them. - Sort of like a mini-database as I understand it)

My question is - using SQL, will I have to execute several statements and
load the dataset manually, or is there some magic SQL command that I can use to get more than one table back at once and magiacally into the dataset? I'm using an access database so I can't use any stored procedures as I
understand it. Don't know of that makes any difference though.

Your advice as always is greatly appreciated.


Generally speaking, ADO.NET (Fill method actually) can read multiple
results from a command.
Now, the question is, if the provider/database supports multiple datasets in
one command.
Sql Server does, but I think that jet/access doesn't support it.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
Nov 22 '05 #2

"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi everyone,

I was wondering if it is possible, to use SQL to return more than one table at a time into a dataset. I only know the basics of SQL and so I'm not sure if I'm just asking a stupid question. But, I'm not proud! :-)

I'm using Ado.net and I'm wanting to load a DataSet object with several
independent tables. (For those who arent ADO.net programmers, a DataSet can hold multiple tables and the relationships and contraints attached to
them. - Sort of like a mini-database as I understand it)

My question is - using SQL, will I have to execute several statements and
load the dataset manually, or is there some magic SQL command that I can use to get more than one table back at once and magiacally into the dataset? I'm using an access database so I can't use any stored procedures as I
understand it. Don't know of that makes any difference though.

Your advice as always is greatly appreciated.

Thanks

Simon

If you want the entire content of several tables independently, you're best
off (IMHO) using multiple queries to get one table at a time (e.g. SELECT *
FROM tablename). A SQL query can be written to retrieve data from multiple
tables, using the relationships between the tables in question to control
the results, but you have to understand both the design of the related
tables in question and SQL itself to do it successfully. A multiple table
query will return the requested data, but the data will be in a single
"table" in the dataset.
If you're going to pursue database application development, you really owe
it to yourself to learn SQL and relational theory. It'll help a lot in the
long run.
Here's one place you could start

http://www.sqlcourse.com/

Another great tool for learning is Access. If you have Access, you can use
it to design tables, set up relationships and, write and debug queries
(starting with QBE and then observing the generated SQL).
--
Peter [MVP Academic]
Nov 22 '05 #3
Thanks guys

Simon
Nov 22 '05 #4

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

Similar topics

3
378
by: Simon Harvey | last post by:
Hi everyone, I was wondering if it is possible, to use SQL to return more than one table at a time into a dataset. I only know the basics of SQL and so I'm not sure if I'm just asking a stupid...
2
13038
by: JS | last post by:
I'm trying to create a data layer and having problems returning a DataSet from my code that's in a class module. Please forgive me. I'm new to C# (VB'er). I decided to create my data layer in...
1
2590
by: Mike Malter | last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I can call that method again later using reflection. I am...
1
1492
by: PCC | last post by:
I am writing a data access layer for a web service. Data from the web service is to be returned as XML. My design dilemma is this... Should I be returning XML from my stored procedures using...
2
1802
by: Simon Harvey | last post by:
Hi everyone, I was wondering if it is possible, to use SQL to return more than one table at a time into a dataset. I only know the basics of SQL and so I'm not sure if I'm just asking a stupid...
0
273
by: Mike | last post by:
Hi, I am trying to solve a problem with a DataSet issue I am having. In my app the user selects certain options and based on those options it goes out to the db to get data based on those...
6
2103
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is...
1
1661
by: Kevin S. Goff | last post by:
Hi, all, Hopefully this will make sense: I have 2 classes that implement the same generic interface. public interface IAgingReport<T> { T GetAgingReport(DateTime dAsOfDate); }
0
2064
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
15
1713
by: Andrew Meador | last post by:
I am working on an application that will store data in SQL Server 2005 Express. The database will reside on our server at the office. I need to write an application that can work with this data off...
0
7134
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
7180
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,...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.