K
kjvt
I originally posted this question to the vb.net newsgroup, but it was
suggested that I re-post here.
I have an application that was converted from VB6 to .Net. The app
uses a data access layer that returns data as disconnected recordsets.
I'm adding new functionality to the app and want to use .Net controls
and data binding. So, I'm converting a recordset to a dataview that
can be bound to a listbox control. I'm doing this conversion via a
data adapter using the following code:
Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _
As DataView
Dim sAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
Dim sTable As System.Data.DataTable = New DataTable
sAdapter.Fill(sTable, pRS)
GetViewFromRS = New DataView(sTable)
End Function
So far so good. The first time I call this function it works
perfectly. However, I need to call it multiple times to update the
DataView as the recordset is modified. The problem is that subsequent
calls to this function for the same recordset always return a DataView
that has no rows (Count = 0).
Can anyone explain why this problem is occuring and how I might work
around it?
Thank you.
Kees VanTilburg
VanTilburg Enterprises
suggested that I re-post here.
I have an application that was converted from VB6 to .Net. The app
uses a data access layer that returns data as disconnected recordsets.
I'm adding new functionality to the app and want to use .Net controls
and data binding. So, I'm converting a recordset to a dataview that
can be bound to a listbox control. I'm doing this conversion via a
data adapter using the following code:
Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _
As DataView
Dim sAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
Dim sTable As System.Data.DataTable = New DataTable
sAdapter.Fill(sTable, pRS)
GetViewFromRS = New DataView(sTable)
End Function
So far so good. The first time I call this function it works
perfectly. However, I need to call it multiple times to update the
DataView as the recordset is modified. The problem is that subsequent
calls to this function for the same recordset always return a DataView
that has no rows (Count = 0).
Can anyone explain why this problem is occuring and how I might work
around it?
Thank you.
Kees VanTilburg
VanTilburg Enterprises