add row from dataview to DataTable

M

MattB

I'm trying (in vb.net) to do something like this:

MyDataTable.Rows.Add(MyDataView.Item(0))

To add a row from a dataview to a datatable (with matching column
structures).
Intellisense won't let me do it. Is there an easy way to get the same
result? Thanks!

Matt
 
G

Greg Burns

try something like this:

Dim drv as DataRowView
....
MyDataTable.LoadDataRow(drv.Row.ItemArray, True)

HTH,
Greg
 
G

Guest

Try using the DataRowView's DataRow property, then the Row's ItemArray
property like this:


MyDataTable.Rows.Add(MyDataView.Item(0).DataRow.ItemArray)

Tim
 
M

MattB

Great. Thanks to you both!

Matt
Try using the DataRowView's DataRow property, then the Row's ItemArray
property like this:


MyDataTable.Rows.Add(MyDataView.Item(0).DataRow.ItemArray)

Tim

:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top