B
Bob L.
Hi, everyone,
I ran into a serious bug upgrading to VS2005, and very easy to reproduce. It
goes like this:
1. Filter a DataView
2. Get a reference to a DataRowView
3. Clear the filter - the reference to the DataRowView has changed to a
completely different row!
This is not a problem in .NET 1.1 - only in 2.0. The code to reproduce the
problem is below. Please help!
Thanks,
Bob L.
Dim oTable As DataTable
Dim oView As DataView
Dim oRowView As DataRowView
'Build simple table
oTable = New DataTable
oTable.Columns.Add("ID", GetType(Integer))
oTable.Rows.Add(New Object() {12})
oTable.Rows.Add(New Object() {25})
'Construct & filter DataView
oView = New DataView(oTable)
oView.RowFilter = "ID=25"
'Get a reference to the found item and display the ID
oRowView = oView.Item(0)
MsgBox(oRowView.Item(0)) 'ID = 25
oView.RowFilter = ""
'Show the same ID again
'In 1.1 this line of code still shows 25 - correct.
'In 2.0 it shows 12 - wrong!
MsgBox(oRowView.Item(0))
I ran into a serious bug upgrading to VS2005, and very easy to reproduce. It
goes like this:
1. Filter a DataView
2. Get a reference to a DataRowView
3. Clear the filter - the reference to the DataRowView has changed to a
completely different row!
This is not a problem in .NET 1.1 - only in 2.0. The code to reproduce the
problem is below. Please help!
Thanks,
Bob L.
Dim oTable As DataTable
Dim oView As DataView
Dim oRowView As DataRowView
'Build simple table
oTable = New DataTable
oTable.Columns.Add("ID", GetType(Integer))
oTable.Rows.Add(New Object() {12})
oTable.Rows.Add(New Object() {25})
'Construct & filter DataView
oView = New DataView(oTable)
oView.RowFilter = "ID=25"
'Get a reference to the found item and display the ID
oRowView = oView.Item(0)
MsgBox(oRowView.Item(0)) 'ID = 25
oView.RowFilter = ""
'Show the same ID again
'In 1.1 this line of code still shows 25 - correct.
'In 2.0 it shows 12 - wrong!
MsgBox(oRowView.Item(0))