473,385 Members | 1,312 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,385 software developers and data experts.

add row from dataview to DataTable

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
Nov 19 '05 #1
3 3071
try something like this:

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

HTH,
Greg

"MattB" <so********@yahoo.com> wrote in message
news:3t************@individual.net...
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

Nov 19 '05 #2
Try using the DataRowView's DataRow property, then the Row's ItemArray
property like this:
MyDataTable.Rows.Add(MyDataView.Item(0).DataRow.It emArray)

Tim

"MattB" wrote:
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

Nov 19 '05 #3
Great. Thanks to you both!

Matt

timkling wrote:
Try using the DataRowView's DataRow property, then the Row's ItemArray
property like this:
MyDataTable.Rows.Add(MyDataView.Item(0).DataRow.It emArray)

Tim

"MattB" wrote:

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

Nov 19 '05 #4

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

Similar topics

2
by: Dianna K. | last post by:
I have a dataview which I am assigning to a Datatable (I am doing this because currently Crystal Reports will not accept a dataview as a Reportsource -- The recommended work-around is to assign...
3
by: Brian Bischof | last post by:
I'm using a third-party tool that takes a DataTable as a parameter. I really need to pass it a DataView instead. When I try to explicitly cast the DataView as a DataTable I get an error that they...
1
by: TaeHo Yoo | last post by:
Hi all, After sorting and grouping data using a dataview, then how to transfer the changed datatable in the dataview to a datatable in C#? Cheers
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
4
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a...
2
by: am72de | last post by:
Hi all, I have a problem with the DataTable.Reset(). After resetting the DataTable the count of the DataView is no longer equal with the DataTable.Rows.Count, so the second Assert fails. ...
1
by: Ronald S. Cook | last post by:
If I add a row to a DataView, will the row automatically be added to the underlying DataTable? If so, I'm trying to understand why anyone would add a row to a DataView when they may as well just...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.