Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent & Child
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Miscellaneous
Thread ID:
00686093
Message ID:
00686232
Views:
41
Dave,

When filling the DataSet *either* way (using multiple SELECT statements in your SqlCommand *or* calling a SP), the tables will be called table, Table1, Table2, etc unless you specify a different name in the Fill(), like this:
MyDataAdapter.Fill(MyDataSet, "MyTable");
But, even doing it this way, the tables will still be named sequentially: MyTable, MyTable1, MyTable2, etc.

What we've done in order to use more meaningful table names is to first generate typed DataSets and then further sub-class them to use different names. Here's an example of what I mean (I'm not putting in all the code, because it's on a different computer and I can't copy/paste to here, but you'll get the gist of it):
// This code is in a sub-class of the typed DataSet:

public tableDataTable Customer
{
  get {return this.table;}
}

public Table1DataTable Orders
{
  get {return this.Table1};
}

// etc. for Table2, Table3 ...
It looks like a lot of work, but we've written a VFP tool (gotta love VFP's string handling capabilities!!) that will generate stuff to and from the Clipboard, so it's easy enough to just plug it into your sub-class.

Hope this gives you some food for thought ...

~~Bonnie



>Bonnie,
>
>When the DataSet is filled, do these results just go in as Table1, Table2, etc? Is there anything you do to give the tables different names?
>
>TIA
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform