ADODB recordset FetchComplete event never fires
Posted on 2004-03-31
Hi, I'm new to this, so I hope someone can help.
I'm trying to write an analysis package which takes some hefty SQL server (version 7) views and then uses the data to generate graphs etc.
The problem is that I'm trying to use an asyncronous recorcordset and then have the fetchcomplete event fire once the recordset is loaded. This is so I can gave a nice little spinning globe while SQL server does it's stuff.
I've tested the view on SQL Query Analyser and it takes about 15 seconds to load, however in my application the fetchcomplete event never seems to fire.
I'm using Windows 2000, MDAC 2.7, VB 6 with Sp 6 loaded
Here's some of the code ... (it's running in form hence a class module)
Dim mblnTimer As Boolean
Dim mtrv As TreeView
Dim mnd As Node
Dim mintSS As Integer
Dim WithEvents mrst As ADODB.Recordset
Dim mblnGotData As Boolean
..code that starts the recordset...
strSQL = "SELECT * FROM " & strView
cnn.CommandTimeout = 200
Set mrst = New ADODB.Recordset
.CursorLocation = adUseClient
.Properties("Initial Fetch Size") = 0
.Open Source:=strSQL, ActiveConnection:=cnn, Options:=adAsyncExecute
.. code that services the fetchcomplete...
Private Sub mrst_FetchComplete(ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal precordset As ADODB.Recordset)
If adStatus <> adStatusOK Then
MsgBox "Record retrieval Failed"
MsgBox "Got the data"
Any ideas anyone ?
Thanks in advance