Simple table mapping?

  • Thread starter Thread starter David Veeneman
  • Start date Start date
D

David Veeneman

What is the easiest way to map table names when filling a dataset?

I am filling a dataset from two tables. My command text looks like this:
"Select * from FooTable; Select * from BarTable". After the fill, the
dataset tables are named 'Table' and 'Table1'. So, I rename the tables using
this code:

myDataset.Tables[0].TableName = "FooTable";
myDataset.Tables[1].TableName = "BarTable";

Table names are the same in both places, and I am trying to avoid the
overhead of loading and caching the database schema.

Is there a simpler way to map names from a database to a dataset? Thanks in
advance for your help.

David Veeneman
Foresight Sstems
 
David said:
What is the easiest way to map table names when filling a dataset?

I am filling a dataset from two tables. My command text looks like
this: "Select * from FooTable; Select * from BarTable". After the
fill, the dataset tables are named 'Table' and 'Table1'. So, I rename
the tables using this code:

myDataset.Tables[0].TableName = "FooTable";
myDataset.Tables[1].TableName = "BarTable";

Table names are the same in both places, and I am trying to avoid the
overhead of loading and caching the database schema.

Is there a simpler way to map names from a database to a dataset?
Thanks in advance for your help.

Check the DataAdapter (SqlDataAdapter for example)'s TableMappings
property.

FB

--
 
Back
Top