473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why use the DataTableMapping in SqlDataAdapter when updating?

Hi,

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

Jason
Dec 12 '05 #1
2 8896
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jason Huang" wrote:
Hi,

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

Jason

Dec 12 '05 #2
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


"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> ¼¶¼g©ó¶l¥ó·s»D:46********************************* *@microsoft.com...
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jason Huang" wrote:
Hi,

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

Jason

Dec 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
399
by: rkbnair | last post by:
-------------------------------------------------------------------------------- I have a problem in updating certain data in an SQL table. Hope, I have the right syntax. It accepts the commands....
1
2089
by: Steven Blair | last post by:
Hi, Here is a short decsription of my problem. I have written a dll for Database accessing. I have one method which can return a Dataset and another method which takes a Dataset and upates a...
3
4349
by: Fernando | last post by:
I am having problems with updating the changes done over a DataSet to a Database. All the changes being done using the Form are stored in the Dataset, but when i decide to close the Form and open...
6
2416
by: Jerry Higgins | last post by:
I added a SqlDataAdapter to a web form, created a data connection, and generated a dataset. I then connected it to a DataGrid control. When I do this using the SqlServer database on my machine...
1
1141
by: trialproduct2004 | last post by:
hi all i am having problem at a time of using sqldataadapter. My adapter is using two tables into which i want to add records. I am using two dataset for updating these table. My problem...
1
8048
by: languy | last post by:
Hi there I'm having a problem when using the SqlDataAdapter. When calling the Update(DataSet, string) method I get the following error message "String or binary data would be truncated". The...
0
873
by: Analizer1 | last post by:
How Can i set SqlData Adapter to update like a Batch Update for instance: I have 10,000 rows that have changed when i call SqlDataAdapter.Update(table) it seems like its updating 1 row at a time...
0
252
by: DaveL | last post by:
c# 2.0, etc, sql server 2005 i have a situation where i will be joing 3 tables in a proc to return a row set of data to be verified by a windows service. example: Select m.TransactionId,...
18
3918
by: navyjax2 | last post by:
What if your event handler has to be nonstatic?
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.