473,405 Members | 2,262 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,405 software developers and data experts.

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.SqlClient 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 24368
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconsettingupdatatabledatacolumnmappings.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(custDS, "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.TableMappings.Add("Customers1", "Orders")
custDA.Fill(custDS, "Customers")Hope this helps.

Manish

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

"Jim" <ssss> wrote in message news:eZ**************@TK2MSFTNGP10.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.SqlClient 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******@hotmail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconsettingupdatatabledatacolumnmappings.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(custDS, "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.TableMappings.Add("Customers1", "Orders")
custDA.Fill(custDS, "Customers")Hope this helps.

Manish

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

"Jim" <ssss> wrote in message

news:eZ**************@TK2MSFTNGP10.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.SqlClient 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**************@TK2MSFTNGP10.phx.gbl...
cheers for that but not what I wanted to do, I want to modify the stored
procedure....

"Manish Jain" <ma******@hotmail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconsettingupdatatabledatacolumnmappings.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(custDS, "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.TableMappings.Add("Customers1", "Orders")
custDA.Fill(custDS, "Customers")Hope this helps.

Manish

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

"Jim" <ssss> wrote in message

news:eZ**************@TK2MSFTNGP10.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.SqlClient 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
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. ...
0
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...
8
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...
7
by: | last post by:
Need help finding simple way to retrieve a fields (or columns) collection from a Dataset without filling it first.
22
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...
4
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...
4
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...
5
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...
7
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...
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: 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?
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
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...
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.