Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy a datarow from VB.net

Status
Not open for further replies.

tutuster

Programmer
Feb 2, 2005
41
0
0
FI
I have a datatable, which has 13 columns of data.

If i need to make an identical copy of some of the datarows (byval id), can this be done by code? Of course, the ID-field will change, but the other data wouldnt be altered. Or is the only solution to get the data, and insert it to the table again?

Thx,
Tus
 
Get the data and insert it as a new row is (probably) the only option.

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
You could duplicate the data table and use ImportRow. something like this:
Code:
 Dim i As Integer 'index of row to duplicate
 Dim dt As New DataTable
 Dim dt2 As DataTable
 dt2 = dt.Copy
 dt2.ImportRow(dt.Rows(i))

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top