PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Dataset and table names.....

Reply

Dataset and table names.....

 
Thread Tools Rate Thread
Old 30-06-2003, 08:30 AM   #1
Jim
Guest
 
Posts: n/a
Default Dataset and table names.....


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


  Reply With Quote
Old 30-06-2003, 08:34 AM   #2
Manish Jain
Guest
 
Posts: n/a
Default Re: Dataset and table names.....

http://msdn.microsoft.com/library/d...-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:eZ3nDHuPDHA.3236@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
>
>



  Reply With Quote
Old 30-06-2003, 09:18 AM   #3
Jim
Guest
 
Posts: n/a
Default Re: Dataset and table names.....

cheers for that but not what I wanted to do, I want to modify the stored
procedure....

"Manish Jain" <manish04@hotmail.com> wrote in message
news:#Z0n8NuPDHA.1608@TK2MSFTNGP11.phx.gbl...
>

http://msdn.microsoft.com/library/d...-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:eZ3nDHuPDHA.3236@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
> >
> >

>
>



  Reply With Quote
Old 30-06-2003, 10:34 AM   #4
Eliyahu Goldin
Guest
 
Posts: n/a
Default Re: Dataset and table names.....

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:ePnrAiuPDHA.3016@TK2MSFTNGP10.phx.gbl...
> cheers for that but not what I wanted to do, I want to modify the stored
> procedure....
>
> "Manish Jain" <manish04@hotmail.com> wrote in message
> news:#Z0n8NuPDHA.1608@TK2MSFTNGP11.phx.gbl...
> >

>

http://msdn.microsoft.com/library/d...-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:eZ3nDHuPDHA.3236@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
> > >
> > >

> >
> >

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off