473,700 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dataset and table names.....

Jim
I have a stored procedure that queries a sql server database and returns the
multiple data tables ( 7 to be precise) these tables are the results of many
joins.
When I use the System.Data.Sql Client namespace objects to access this data
it is returned intoa dataset, this dataset has the tables as expected but
they are name 'Table', 'Table1' , 'Table2' etc....

How can I ge the table name to be more friendly as in "Customers" , "Rates"
etc, I was thinking of modifying the sql stored procedure, can anyone help?
Cheers

Jim
Nov 13 '05 #1
3 24389
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconsettingupd atatabledatacol umnmappings.asp
Multiple Result Sets
If your SelectCommand returns multiple tables, Fill will automatically
generate table names with incremental values for the tables in the DataSet,
starting with the specified table name and continuing on in the form
TableNameN, starting with "TableName1 ". You can use table mappings to map
the automatically generated table name to a name you want specified for the
table in the DataSet. For example, for a SelectCommand that returns two
tables, Customers and Orders, issue the following call to Fill.

custDA.Fill(cus tDS, "Customers" )Two tables are created in the DataSet:
Customers and Customers1. You can use table mappings to ensure that the
second table is named Orders instead of Customers1. To do this, map the
source table of Customers1 to the DataSet table Orders, as shown in the
following example.

custDA.TableMap pings.Add("Cust omers1", "Orders")
custDA.Fill(cus tDS, "Customers")Hop e this helps.

Manish

--------------------------------------------------------

"Jim" <ssss> wrote in message news:eZ******** ******@TK2MSFTN GP10.phx.gbl...
I have a stored procedure that queries a sql server database and returns the multiple data tables ( 7 to be precise) these tables are the results of many joins.
When I use the System.Data.Sql Client namespace objects to access this data it is returned intoa dataset, this dataset has the tables as expected but
they are name 'Table', 'Table1' , 'Table2' etc....

How can I ge the table name to be more friendly as in "Customers" , "Rates"
etc, I was thinking of modifying the sql stored procedure, can anyone help?

Cheers

Jim

Nov 13 '05 #2
Jim
cheers for that but not what I wanted to do, I want to modify the stored
procedure....

"Manish Jain" <ma******@hotma il.com> wrote in message
news:#Z******** ******@TK2MSFTN GP11.phx.gbl...
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconsettingupd atatabledatacol umnmappings.asp
Multiple Result Sets
If your SelectCommand returns multiple tables, Fill will automatically
generate table names with incremental values for the tables in the DataSet, starting with the specified table name and continuing on in the form
TableNameN, starting with "TableName1 ". You can use table mappings to map
the automatically generated table name to a name you want specified for the table in the DataSet. For example, for a SelectCommand that returns two
tables, Customers and Orders, issue the following call to Fill.

custDA.Fill(cus tDS, "Customers" )Two tables are created in the DataSet:
Customers and Customers1. You can use table mappings to ensure that the
second table is named Orders instead of Customers1. To do this, map the
source table of Customers1 to the DataSet table Orders, as shown in the
following example.

custDA.TableMap pings.Add("Cust omers1", "Orders")
custDA.Fill(cus tDS, "Customers")Hop e this helps.

Manish

--------------------------------------------------------

"Jim" <ssss> wrote in message

news:eZ******** ******@TK2MSFTN GP10.phx.gbl...
I have a stored procedure that queries a sql server database and returns

the
multiple data tables ( 7 to be precise) these tables are the results of

many
joins.
When I use the System.Data.Sql Client namespace objects to access this

data
it is returned intoa dataset, this dataset has the tables as expected but they are name 'Table', 'Table1' , 'Table2' etc....

How can I ge the table name to be more friendly as in "Customers" , "Rates" etc, I was thinking of modifying the sql stored procedure, can anyone

help?


Cheers

Jim


Nov 13 '05 #3
This won't help. Your tables will be named as they are: Table, Table1 etc.
But, if you are planning to fill a dataset out of your dataadapter, you can
rename the tables by mapping, as the previous message says.

HTH,

Eliyahu

"Jim" <ssss> wrote in message news:eP******** ******@TK2MSFTN GP10.phx.gbl...
cheers for that but not what I wanted to do, I want to modify the stored
procedure....

"Manish Jain" <ma******@hotma il.com> wrote in message
news:#Z******** ******@TK2MSFTN GP11.phx.gbl...

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconsettingupd atatabledatacol umnmappings.asp
Multiple Result Sets
If your SelectCommand returns multiple tables, Fill will automatically
generate table names with incremental values for the tables in the

DataSet,
starting with the specified table name and continuing on in the form
TableNameN, starting with "TableName1 ". You can use table mappings to map
the automatically generated table name to a name you want specified for

the
table in the DataSet. For example, for a SelectCommand that returns two
tables, Customers and Orders, issue the following call to Fill.

custDA.Fill(cus tDS, "Customers" )Two tables are created in the DataSet:
Customers and Customers1. You can use table mappings to ensure that the
second table is named Orders instead of Customers1. To do this, map the
source table of Customers1 to the DataSet table Orders, as shown in the
following example.

custDA.TableMap pings.Add("Cust omers1", "Orders")
custDA.Fill(cus tDS, "Customers")Hop e this helps.

Manish

--------------------------------------------------------

"Jim" <ssss> wrote in message

news:eZ******** ******@TK2MSFTN GP10.phx.gbl... I have a stored procedure that queries a sql server database and
returns
the
multiple data tables ( 7 to be precise) these tables are the results
of many
joins.
When I use the System.Data.Sql Client namespace objects to access this

data
it is returned intoa dataset, this dataset has the tables as expected

but they are name 'Table', 'Table1' , 'Table2' etc....

How can I ge the table name to be more friendly as in "Customers" , "Rates" etc, I was thinking of modifying the sql stored procedure, can anyone

help?


Cheers

Jim



Nov 13 '05 #4

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

Similar topics

3
4602
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. I'm getting some strange results depending the input XML file I use. I was wondering if somebody could help me understand what is going on or point me to a good reference. The code for my program looks like this:
0
3613
by: Ralph Hanan | last post by:
Hi guys my name is Ralph, i am kinda new to this so please bear with me. I have written a .net web service which accepts a stream of data see relevent source code). Public Function PutBondInfo(ByVal data As String) As DataSet Try Dim zh As New ZipHelper Dim sz As String Dim cn As SqlConnection
8
2256
by: drg | last post by:
I have a DataSet with a DateTime field. I am using an EventRow r, to update it with values from a TextBox in a DataGrid. Suppose a DataGrid in edit mode had a field with value: 7/7/2005. Then the user deletes this value. Now, I want to update the DataSet (I know how to update the database) with a statement like this: r.MyDate = null. However, I can't seem to find the syntax to do this. Thanks!
7
21040
by: | last post by:
Need help finding simple way to retrieve a fields (or columns) collection from a Dataset without filling it first.
22
4224
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty SQL table? Is there a short way like the FILL method to get data into the dataset or do I have to read each datarow in the table and write it one at the time to the
4
3751
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure and username, password etc will be exactly the same for each server, the only thing that will change is the server name. Idealy I would like to get the server names from a seperate dataset so there could be any number of servers, allthough in...
4
1784
by: astro | last post by:
I would like to build some generic code that is able to figure out the correct dataAdapter to apply changes to given a form with several dataAdapters. Any suggestions on the following? Thank you. ====================================== Private Sub SaveChanges(ByVal aContainer As Object)
5
6843
by: needin4mation | last post by:
Hi, I have a webservice that just returns a count: public DataSet HelloWorld() { OdbcConnection conn = new OdbcConnection("DSN=xxx"); String sqlString = "select count(*) as employee from employees"; DataSet myResults = new DataSet(); OdbcDataAdapter myAdapter = new OdbcAdapter(sqlString, conn); myAdapter.Fill(myResults); return myResults;
7
2090
by: samoore33 | last post by:
I want to list all of the items in a dataset in a textbox. The dataset has multiple tables. When I try to use the code below, even though I dim myState as the DataTable("state"). It still looks for othe rows in the dataset. Dim myState As DataTable = myDataSet.Tables("state") Dim myTax As DataTable = myDataSet.Tables("Tax") Dim row As DataRow Dim column As DataColumn
0
9218
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9081
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8975
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8929
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7816
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5904
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4408
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.