Why use the DataTableMapping in SqlDataAdapter when updating?

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

I am wondering why use the DataTableMapping in SqlDataAdapter when Updating
data.
Would someone give me some advice?
Thanks for help.

Jason
 
The TableMappings collection controls how the DataAdapter maps your DataSet
to your database. If you leave a DataAdapter object’s TableMappings
collection empty, call the Fill method, and supply a DataSet as a parameter
without specifying a table name, the DataAdapter will assume that you want to
work with a DataTable called Table.

The TableMappings property returns a DataTableMappingCollection object. This
object contains a collection of DataTableMapping objects. Adding the
following line of code adds a DataTableMapping object to the TableMappings
collection to tell the DataAdapter that it should communicate with a
DataTable called Employees instead:

DataAdapter.TableMappings.Add("Table", "Employees")

Once you’ve created a DataTableMapping object, you can create column
mappings for the table.

--Peter
 
Thanks Peter.
But I am wondering why we need to use the TableMapping and ColumnMapping, it
seems taht we can do table manipulation without the Mappings.


Jason
 
Back
Top