Marc Uberstein
Marc Uberstein

Reputation: 12541

Naming DataTable in a DataSet using SQL?

I have built a backend system that allows a user to add multiple content section, widgets etc.

I want to keep the queries to the SQL server to a minimum for performance reasons, this is my current flow:

  1. I check my main table which widgets have been added.
  2. I run through each row and build the 'batch' sql query that gets content from mulitple tables.
  3. Call the completed list of queries.
  4. I populate in a DataSet.

Now for the problem:

The tables will never be in the same order, and I can't find a way to name the returned tables.

Is it best to just dedicate a column in each returned DataTable to specify what it actually is, and loop through the DataSet?

Or is there actually a way of naming the returned tables?

Upvotes: 3

Views: 323

Answers (2)

Marc Uberstein
Marc Uberstein

Reputation: 12541

Nobody replied with an answer for specifying DataTables in a DataSet, so I ended up adding a Column to each DataTable making it unique and "searchable" solving my problem.

Upvotes: 0

Mariusz
Mariusz

Reputation: 1409

There is no way to do it automatically, as far as I know. You can give table mappings a try -> http://geekswithblogs.net/dotNETvinz/archive/2009/08/03/why-dataset-creates-tablen-as-the-default-table-name.aspx

Upvotes: 1

Related Questions