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

DataSet Question

Let's say I have a query that looks like this:

SELECT Orders.*, Status.NAME
FROM Orders, Status
WHERE Orders.UserId = @UserID
AND Orders.StatusId = Status.StatusId

When I use that populate a DataSet via a DataAdapter, do I get two new
tables or one? What I want is a single table that is the amalgam of
both. Is this possible?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #1
2 1558
I suggest listing all fields you want instead of the asterisk
notation. Helps to figure out what is going on later. Also, the use of
@UserID, unless you are looking at writing a stored procedure seems
out of place. I assume you will be passing the ID that want into the
SQL text somehow and this is how you are showing it in the newsgroup.
If so, continue. The code you provide will give you what you want, but
there are other, more succinct ways of writing the statement if you
are using SQL Server / Oracle, etc.
On Mon, 22 Dec 2003 16:11:53 -0600, "Frank Oquendo"
<fr****@acadxpin.com> wrote:
Let's say I have a query that looks like this:

SELECT Orders.*, Status.NAME
FROM Orders, Status
WHERE Orders.UserId = @UserID
AND Orders.StatusId = Status.StatusId

When I use that populate a DataSet via a DataAdapter, do I get two new
tables or one? What I want is a single table that is the amalgam of
both. Is this possible?


Nov 15 '05 #2
Frank,

You should really re-write the SQL statement as:

SELECT Orders.*, Status.NAME
FROM Orders
INNER JOIN Status ON Orders.StatusId = Status.StatusId
WHERE Orders.UserId = @UserID

This will get you one table - I think the other will get you two - but don't
quote me on it. Also, depending on your database structure you may not want
to use an inner join. This is really mroe of a question for a SQL user
group, not a C# group.

Matt

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:35********************************@4ax.com...
I suggest listing all fields you want instead of the asterisk
notation. Helps to figure out what is going on later. Also, the use of
@UserID, unless you are looking at writing a stored procedure seems
out of place. I assume you will be passing the ID that want into the
SQL text somehow and this is how you are showing it in the newsgroup.
If so, continue. The code you provide will give you what you want, but
there are other, more succinct ways of writing the statement if you
are using SQL Server / Oracle, etc.
On Mon, 22 Dec 2003 16:11:53 -0600, "Frank Oquendo"
<fr****@acadxpin.com> wrote:
Let's say I have a query that looks like this:

SELECT Orders.*, Status.NAME
FROM Orders, Status
WHERE Orders.UserId = @UserID
AND Orders.StatusId = Status.StatusId

When I use that populate a DataSet via a DataAdapter, do I get two new
tables or one? What I want is a single table that is the amalgam of
both. Is this possible?

Nov 15 '05 #3

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

Similar topics

3
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
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...
2
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
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...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
2
by: Jeff Brown | last post by:
OK i have came to the conclusion that since this app will be run on multiple computers that loading a complete database and then updating on exit is a moot point. I have tried several ideas...
4
by: markerussell | last post by:
I have a question, in that if i have an application is it better to have one dataset per data adapter, ie daCustomerTable -> dsCustomer, daOrders -> dsOrders etc. or to say have a couple of dataset...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
2
by: JT | last post by:
I have an SQL database with one table in it. I want to load the table into a DataSet, add new records to the DataSet, then commit the changes back to the database. Using C#.NET, the following...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.