473,797 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

appending rows to datatable

Hi all,

This is the way to append the rows from one datatable into another with the
same schema.

Here Temp and Temp1 are the datatables

For Each rows As DataRow In tempTable.Rows
Temp1 .NewRow()
Temp1 .ImportRow(rows )
Next

-Vignesh.S
Nov 16 '05 #1
2 15014
check out ItemArray on the DataRow class

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdata datarowclassite marraytopic.asp

something like:

foreach(Datarow row in Table1.Rows)
{
DataRow newRow = Table2.NewRow() ;
newRow.ItemArra y = row.ItemArray;
}

--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"shankar" <sh*****@discus sions.microsoft .com> wrote in message
news:EF******** *************** ***********@mic rosoft.com...
Hi all,

This is the way to append the rows from one datatable into another with the same schema.

Here Temp and Temp1 are the datatables

For Each rows As DataRow In tempTable.Rows
Temp1 .NewRow()
Temp1 .ImportRow(rows )
Next

-Vignesh.S

Nov 16 '05 #2
should have been

foreach(Datarow row in Table1.Rows)
{
DataRow newRow = Table2.NewRow() ;
newRow.ItemArra y = row.ItemArray;

Table2.Rows.Add (newRow);
}

Ollie Riches
"Ollie Riches" <ol**********@p honeanalser.net > wrote in message
news:ux******** ******@TK2MSFTN GP12.phx.gbl...
check out ItemArray on the DataRow class

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemdata datarowclassite marraytopic.asp

something like:

foreach(Datarow row in Table1.Rows)
{
DataRow newRow = Table2.NewRow() ;
newRow.ItemArra y = row.ItemArray;
}

--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"shankar" <sh*****@discus sions.microsoft .com> wrote in message
news:EF******** *************** ***********@mic rosoft.com...
Hi all,

This is the way to append the rows from one datatable into another with

the
same schema.

Here Temp and Temp1 are the datatables

For Each rows As DataRow In tempTable.Rows
Temp1 .NewRow()
Temp1 .ImportRow(rows )
Next

-Vignesh.S


Nov 16 '05 #3

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

Similar topics

5
16280
by: jurson | last post by:
Hello, I remove row from DataTable. It works ok, the row is removed from collection. It should be marked as 'detached'. Am I right? Then I try to retrieve 'detached' rows using the code shown below. _currentEntryBE.Tables.Rows.Remove(dr); DataTable dt = _currentEntryBE.Tables.GetChanges(System.Data.DataRowState.Detached);
2
2243
by: tony.collings | last post by:
I started a thread here : http://groups.google.co.uk/group/microsoft.public.cmserver.general/browse_thread/thread/29d63077144004a9/c3888efdcb7338f6?hl=en#c3888efdcb7338f6 About creating an Email function to email authors when the Review Date has expired on their page. I've managed to now achieve a significant proportion of the work by writing out the details to an XML file and reading them back. However I'm a little stuck on Amending...
1
3299
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly simple one, in theory anyway. The gist is to create a page where the user enters an IDNumber,...
7
3927
by: GaryB | last post by:
I have an untyped datatable that has financial numbers and controls that were populated by code (not a simple fill from a DA). Now I want to insert subtotals into it. I wrote a sub to do so that uses InsertAt(myrow,i). When I trace through the sub it is doing the insertat and the value of i is correct. But when I bind my dataset to a datagrid all of my inserted rows are at the end? code is below. What am I doing wrong? thanks, G
5
1680
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't this in essence a table i.e. a collection of rows? The reason I ask is that I wanted to extract from the array of rows
1
19794
by: Lars E | last post by:
Hi all I have a small problem. I have a datatable with 8 columns. But it is only data in 5 of the columns. Data for the remaing 3 columns is in another dataset. I Want to run trough the datatable and fill out the remaining data. My code so far: if (this.fetch("custinfo", "fetchCustInfo", out customers, parameters))
2
4845
by: Mark | last post by:
Hi - I'm looking for a code sample that will let me append a data table to a second master data table. You can assume that the tables' structures are identical. Seems like there should be a method to do this, but I can't find one. Thanks, Mark
3
5416
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some example first:
3
32281
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable filtered by the dataview into a separate table? I only want to copy the rows from the main table that...
0
10469
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10209
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7560
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6803
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
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 we have to send another system
3
2934
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.