Solved

Get a DataRow from a DataView--Import from one DataSet to another

Posted on 2007-03-22
2
575 Views
Last Modified: 2007-03-22
In VB .NET 2003, I want to import several records from one DataSet to another. I can easily isolate the records I want using a .RowFilter on a DataView, but I can't figure out how to import the results to the second DataSet, because .ImportRow wants a DataRow as input, and a DataView structures its results as DataRowView. Trying to do a CType(drview, DataRow) gives an error. I'm sure there must be something simple I'm missing, but I have no idea what the process would be.

(If there's a better way to select the proper records from the first dataset, I'm up for that, though I wouldn't mind understanding DataView usage a bit better in any case.)
0
Comment
Question by:ElrondCT
2 Comments
 
LVL 34

Accepted Solution

by:
Sancler earned 500 total points
ID: 18775957
A DataRowView has a .Row property, which returns a DataRow: that is, the relevant DataRow from the DataTable on which the DataView is based.

Another way would be to use .Select on the DataTable itself, with text similar to that you would use in DataView.RowFilter.

Roger
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 18776976
Thanks, Roger. I figured it had to be something straightforward, but there are so many nooks and crannies to look in for properties!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question