I wasn't quite sure where to put this so I decided that it should work as a general question.
I have a XML file that I've loaded into a strongly typed dataset and am now trying to query against using a dataview. It's loading everything into the dataview and i'm able to loop through it, but my rowfilter doesn't seem to work. When I go to loop through it returns all rows from the dataset, not just the result set that I'm expecting. Here is my code:
Here is a sample of what my XML file looks like:
typedBatchData is my strongly typed dataset. Basically, I only want it to return rows where the deleteFlag field is false (I've also tried putting false in single quotes and got the same results as without), yet when i go through it returns everything. And I know that instead of using a DataRow in my loop, I should be using 'For Each dr As DataRowView in view', but when i tried that it basically said there was nothing there and skipped to 'End Sub'. So I guess another question I have is why thats not working.
Any help you can give me would be very appreciated. This is my first time working with dataviews and while I think I have some of the basics down, I'm feeling lost right now. Thanks
I have a XML file that I've loaded into a strongly typed dataset and am now trying to query against using a dataview. It's loading everything into the dataview and i'm able to loop through it, but my rowfilter doesn't seem to work. When I go to loop through it returns all rows from the dataset, not just the result set that I'm expecting. Here is my code:
VB.NET:
Private Sub createMultiTiffs(ByVal outputDirectory As String)
'this sub will create the multipage tiffs for output
Dim view As DataView = New DataView
With view
.Table = typedBatchData.Tables(0)
.AllowDelete = True
.AllowEdit = True
.AllowNew = True
.RowFilter = "deleteFlag = false"
.RowStateFilter = DataViewRowState.ModifiedCurrent
.Sort = "docNumber"
End With
For Each dr As DataRow In view.Table.Rows
'For testing that I'm looping through. Its grabbing all my records though
MessageBox.Show("Image Name: " & dr.Item(0).ToString & vbCrLf & "DeleteFlag: " & dr.Item(1).ToString)
Next
End Sub
Here is a sample of what my XML file looks like:
VB.NET:
<batchItems>
<imageXML>
<origName>C:\Test\0001A01.TIF</origName>
<deleteFlag>false</deleteFlag>
<docNumber>8675309</docNumber>
</imageXML>
<imageXML>
<origName>C:\Test\0001A02.TIF</origName>
<deleteFlag>true</deleteFlag>
<docNumber>1234567</docNumber>
</imageXML>
</batchItems>
typedBatchData is my strongly typed dataset. Basically, I only want it to return rows where the deleteFlag field is false (I've also tried putting false in single quotes and got the same results as without), yet when i go through it returns everything. And I know that instead of using a DataRow in my loop, I should be using 'For Each dr As DataRowView in view', but when i tried that it basically said there was nothing there and skipped to 'End Sub'. So I guess another question I have is why thats not working.
Any help you can give me would be very appreciated. This is my first time working with dataviews and while I think I have some of the basics down, I'm feeling lost right now. Thanks