473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Copying datatable contents to another datatable

VM
How can I copy the contents of one datatable to another datatable? I've
already the source table so I only need to copy its rows.

Thanks.
Nov 16 '05 #1
3 2100
VM,
Are the table structures identical? (same fields, same types, same sequence
of fields)

I normally use a for each loop on the source table's rows collection then
DataTable.ImportRow on the destination table.

Hope this helps
Jay

"VM" <vo******@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP12.phx.gbl...
How can I copy the contents of one datatable to another datatable? I've
already the source table so I only need to copy its rows.

Thanks.

Nov 16 '05 #2
VM
Thanks, it worked.
The reason I created a copy of the table was so I could set the datagrid
datasource to this clone table while the main table is being filled. So I
copy the data from one table to the other every 1500 records. The problem is
that once I set the datasource, I keep on seeing the grid being updated. And
it shouldn't, since I copy the data from one table to another every 1500
records so the grid should be updated with 1500-record chunks (not
individually).

Am I doing somethinw wrong?

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
VM,
Are the table structures identical? (same fields, same types, same sequence of fields)

I normally use a for each loop on the source table's rows collection then
DataTable.ImportRow on the destination table.

Hope this helps
Jay

"VM" <vo******@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP12.phx.gbl...
How can I copy the contents of one datatable to another datatable? I've
already the source table so I only need to copy its rows.

Thanks.


Nov 16 '05 #3
VM,
It sounds like you bound to the wrong DataTable.

Without seeing your code it would be hard to actually say.

Hope this helps
Jay

"VM" <vo******@yahoo.com> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
Thanks, it worked.
The reason I created a copy of the table was so I could set the datagrid
datasource to this clone table while the main table is being filled. So I
copy the data from one table to the other every 1500 records. The problem is that once I set the datasource, I keep on seeing the grid being updated. And it shouldn't, since I copy the data from one table to another every 1500
records so the grid should be updated with 1500-record chunks (not
individually).

Am I doing somethinw wrong?

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
VM,
Are the table structures identical? (same fields, same types, same

sequence
of fields)

I normally use a for each loop on the source table's rows collection then DataTable.ImportRow on the destination table.

Hope this helps
Jay

"VM" <vo******@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP12.phx.gbl...
How can I copy the contents of one datatable to another datatable? I've already the source table so I only need to copy its rows.

Thanks.



Nov 16 '05 #4

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

Similar topics

5
by: Nathan Sokalski | last post by:
I am writing an ASP.NET application in which I need to copy DataRows from one DataTable to another. When I use code such as the following: temprows = nodes.Select("state='PA'")...
9
by: Rui Sampainho | last post by:
Hi Is there any command to transfer the contents of a datatable to an array. What I'm looking for is sort of a bulk process, not an iteration with a loop based on a field by field or row by row...
3
by: Gene Hubert | last post by:
I'm using DataTable.ImportRow to move data from one datatable to another... Dim dt, dtTarget As DataTable Dim dr As DataRow dt = DirectCast(Me.DataSource, DataTable) dtTarget = dt.Clone...
3
by: Coleen | last post by:
Hi all :-) I have a datatable that I need to clone completely except for 1 column - I need to replace the contents of this 1 column with the contents from another datatable that has the exact...
11
by: Geoff | last post by:
Hi I have a DataTable with thousands of rows. I want a quick way to insert the rows into a table in an Access database with the same structure. I have been using an update command but found it...
4
by: Adrian Parker | last post by:
We've suddenly started getting a problem with a call to clear the contents of a DataTable. This is on a live customer site that's been working fine until yesterday. As far as we know they've not...
7
by: Wayne Gibson | last post by:
Hi All, Was wondering if anybody could help. I'm currently trying to copy a record from datatable to another. I have two problems: 1) Transferring the record from one datatable to another. 2)...
9
by: Jess | last post by:
Hello, I tried to clear a vector "v" using "v.clear()". If "v" contains those objects that are non-built-in (e.g. string), then "clear()" can indeed remove all contents. However, if "v"...
1
by: tshad | last post by:
Running on VS.net 2005, I am trying to copy rows from my datatable to another datatable in the same dataset. The schema would be identical. I need to make the table name "forms" as I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.