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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I requery a dataview when changing the row filter

Status
Not open for further replies.

asmith555

Programmer
Oct 7, 2002
97
US
I create a dataview from a datatable in which I use to send to an outside object accepting a dataview as a parameter.

The process goes as such.
Psudocode:
Open main datatable
for each tablerow in datatabletable
create new dataview
set dataview row filter to tablerow item(x)
create new object(dataview)
do stuff w/object...
destroy dataview
next

when the loop comes back in for the second time the rowfilter is changed successfully but the data within isnt


I loop through a table for the values to set the row filter
The row filter is successfully changed but the data in the dataview is not changed. This doesnt make since because I destroy and recreate the dv on every pass. It seems like a am missing a step in which i call some kind of requerying method. Any help is appreciated.

CODE

For Each drow As DataRow In xmlDs.Tables(2).Rows
If drow("eventid") <> EventHold Then
dview = New DataView(xmlDs.Tables(2))
Dim a As String = drow("eventid")
dview.RowFilter = "eventid = '" & drow("eventid") & "'"
dview.Sort = "formctl"
dview.RowStateFilter = DataViewRowState.Added
a = dview.Table.Rows(0).Item("eventid")
!!!!!!!!!When I Query for "a" I get the old value!!!!!!!!!!
propEvent = New clsPropEvent(dview)
loadControl(propEvent.EventControl)
dview.Dispose()
dview = Nothing
propEvent = Nothing
EventHold = drow("eventid")
End If
 
This line is incorrect.
a = dview.Table.Rows(0).Item("eventid")
You are actually going to the undeline table not the dataview.

try something like this

a = CStr(dview(0)("eventid"))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top