Professional Web Applications Themes

Dataset and table names..... - Microsoft SQL / MS SQL Server

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...

  1. #1

    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


    Jim Guest

  2. #2

    Default Re: Dataset and table names.....

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
    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.3236TK2MSFTNGP10.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
    >
    >

    Manish Jain Guest

  3. #3

    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" <manish04hotmail.com> wrote in message
    news:#Z0n8NuPDHA.1608TK2MSFTNGP11.phx.gbl...
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
    > 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.3236TK2MSFTNGP10.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
    > >
    > >
    >
    >

    Jim Guest

  4. #4

    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.3016TK2MSFTNGP10.phx.gbl...
    > cheers for that but not what I wanted to do, I want to modify the stored
    > procedure....
    >
    > "Manish Jain" <manish04hotmail.com> wrote in message
    > news:#Z0n8NuPDHA.1608TK2MSFTNGP11.phx.gbl...
    > >
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
    > > 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.3236TK2MSFTNGP10.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
    > > >
    > > >
    > >
    > >
    >
    >

    Eliyahu Goldin Guest

Similar Threads

  1. Database table names
    By saver2th in forum Coldfusion Database Access
    Replies: 3
    Last Post: April 17th, 06:28 AM
  2. Dataset to table
    By John in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 14th, 02:25 AM
  3. How best to grab SQL table names?
    By Dan Anderson in forum PERL Beginners
    Replies: 4
    Last Post: November 10th, 05:11 PM
  4. Replies: 2
    Last Post: October 31st, 02:43 AM
  5. Access table names
    By Marina in forum ASP.NET General
    Replies: 1
    Last Post: August 4th, 04:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139