MS ADO Guru Needed 
Author Message
 MS ADO Guru Needed

Hi
I'm using a generic data transfer form to manage the downloading of
recordsets from a SQL Server db sitting on a web host. The form is
managed from a class module which manages all recordset processes.
For small downloads (< 100 records) adAsyncFetch is not used. For larger
recordsets adAsyncFetch is used to give visual feedback using a counter
and progressbar. The process works great until the end of
MyRs_FetchComplete when VB6 crashes:

Err message: This program has performed an illegal operation and will be
shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
0137:1f49029c etc - and VB closes down.

Any advice or ideas are welcome as I'm stuck.
Ta
Dave

Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
                      adStatus As ADODB.EventStatusEnum, _
                      ByVal pRecordset As ADODB.Recordset)

If bStopped = False Then
    Set cAdo.Recordset = MyRs
    cAdo.RecordsetIsOpen = True
    cAdo.TidyUp
ElseIf bStopped = True Then
    Set cAdo.Recordset = Nothing
    bStopped = False
End If
     <-----error occurs here and vb crashes
End Sub

in the class module

Public Sub TidyUp()
On Error GoTo vbError
        If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
            If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
                Set Recordset = frmDataTransfer.cAdo.Recordset
                RecordsetIsOpen = True
                If Not GradientPicture Is Nothing Then UpdateGradient
            End If
        End If
        Unload frmDataTransfer
Exit Sub
vbError:
eError
End Sub



Sun, 08 May 2005 04:18:04 GMT  
 MS ADO Guru Needed
You need to make sure all your objects that have been open are closed and
are set to nothing and your cursorlocation =3. AsyncFetch should be used
with less than 100 records and not used when fetching larger records.

HTH
.


Quote:
> Hi
> I'm using a generic data transfer form to manage the downloading of
> recordsets from a SQL Server db sitting on a web host. The form is
> managed from a class module which manages all recordset processes.
> For small downloads (< 100 records) adAsyncFetch is not used. For larger
> recordsets adAsyncFetch is used to give visual feedback using a counter
> and progressbar. The process works great until the end of
> MyRs_FetchComplete when VB6 crashes:

> Err message: This program has performed an illegal operation and will be
> shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
> 0137:1f49029c etc - and VB closes down.

> Any advice or ideas are welcome as I'm stuck.
> Ta
> Dave

> Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
>                       adStatus As ADODB.EventStatusEnum, _
>                       ByVal pRecordset As ADODB.Recordset)

> If bStopped = False Then
>     Set cAdo.Recordset = MyRs
>     cAdo.RecordsetIsOpen = True
>     cAdo.TidyUp
> ElseIf bStopped = True Then
>     Set cAdo.Recordset = Nothing
>     bStopped = False
> End If
>      <-----error occurs here and vb crashes
> End Sub

> in the class module

> Public Sub TidyUp()
> On Error GoTo vbError
>         If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
>             If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
>                 Set Recordset = frmDataTransfer.cAdo.Recordset
>                 RecordsetIsOpen = True
>                 If Not GradientPicture Is Nothing Then UpdateGradient
>             End If
>         End If
>         Unload frmDataTransfer
> Exit Sub
> vbError:
> eError
> End Sub



Sun, 08 May 2005 13:54:32 GMT  
 MS ADO Guru Needed
Hello Dave

In your class module, try this

Event MyRSAsyncFetchComplete()
Event MyRSAsyncFetchProgressComplete(ByVal Progress As Long, MaxProgress As
Long)
Public WithEvents MyRS as Recordset

Public Sub GetRecords()
   On Error GoTo  ShowError
   If MyRS Is Nothing Then
        Set MyRS = New Recordset
        With MyRS
            'HERE YOU SET RECORDSET'S PROPERTIES LIKE_
            CacheSize, CursorLocation, CursorType & LockType
        End with
   Else
      MyRS.Close
   End If
   'HERE YOU SET THE CONNECTION MyCon
    MyRS.Open MyCon, , , , adAsyncExecute OR adAysncFetch
Exit Sub
ShowError:
    ''ERROR CODE HERE
End Sub

Private Sub MyRSAsync_FetchComplete(ByVal pError As ADODB.Error, _
       adStatus As ADODB.EventStatusEnum, _
       ByVal pRecordset As ADODB.Recordset)
    RaiseEvent MyRSAsyncFetchComplete
End Sub

Private Sub MyRAsync_FetchProgress(ByVal pError As ADODB.Error, _
       adStatus As ADODB.EventStatusEnum, _
       ByVal pRecordset As ADODB.Recordset)
    RaiseEvent MyRSAsyncFetchProgress(Progress,MaxProgress)
End Sub

HTH
Happy Computing

Sukesh


Quote:
> Hi
> I'm using a generic data transfer form to manage the downloading of
> recordsets from a SQL Server db sitting on a web host. The form is
> managed from a class module which manages all recordset processes.
> For small downloads (< 100 records) adAsyncFetch is not used. For larger
> recordsets adAsyncFetch is used to give visual feedback using a counter
> and progressbar. The process works great until the end of
> MyRs_FetchComplete when VB6 crashes:

> Err message: This program has performed an illegal operation and will be
> shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
> 0137:1f49029c etc - and VB closes down.

> Any advice or ideas are welcome as I'm stuck.
> Ta
> Dave

> Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
>                       adStatus As ADODB.EventStatusEnum, _
>                       ByVal pRecordset As ADODB.Recordset)

> If bStopped = False Then
>     Set cAdo.Recordset = MyRs
>     cAdo.RecordsetIsOpen = True
>     cAdo.TidyUp
> ElseIf bStopped = True Then
>     Set cAdo.Recordset = Nothing
>     bStopped = False
> End If
>      <-----error occurs here and vb crashes
> End Sub

> in the class module

> Public Sub TidyUp()
> On Error GoTo vbError
>         If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
>             If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
>                 Set Recordset = frmDataTransfer.cAdo.Recordset
>                 RecordsetIsOpen = True
>                 If Not GradientPicture Is Nothing Then UpdateGradient
>             End If
>         End If
>         Unload frmDataTransfer
> Exit Sub
> vbError:
> eError
> End Sub



Sun, 08 May 2005 16:33:31 GMT  
 MS ADO Guru Needed
Hi Dave,

Which version of ADO do you have?

--
Val Mazur
Microsoft MVP


Quote:
> Hi
> I'm using a generic data transfer form to manage the downloading of
> recordsets from a SQL Server db sitting on a web host. The form is
> managed from a class module which manages all recordset processes.
> For small downloads (< 100 records) adAsyncFetch is not used. For larger
> recordsets adAsyncFetch is used to give visual feedback using a counter
> and progressbar. The process works great until the end of
> MyRs_FetchComplete when VB6 crashes:

> Err message: This program has performed an illegal operation and will be
> shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
> 0137:1f49029c etc - and VB closes down.

> Any advice or ideas are welcome as I'm stuck.
> Ta
> Dave

> Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
>                       adStatus As ADODB.EventStatusEnum, _
>                       ByVal pRecordset As ADODB.Recordset)

> If bStopped = False Then
>     Set cAdo.Recordset = MyRs
>     cAdo.RecordsetIsOpen = True
>     cAdo.TidyUp
> ElseIf bStopped = True Then
>     Set cAdo.Recordset = Nothing
>     bStopped = False
> End If
>      <-----error occurs here and vb crashes
> End Sub

> in the class module

> Public Sub TidyUp()
> On Error GoTo vbError
>         If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
>             If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
>                 Set Recordset = frmDataTransfer.cAdo.Recordset
>                 RecordsetIsOpen = True
>                 If Not GradientPicture Is Nothing Then UpdateGradient
>             End If
>         End If
>         Unload frmDataTransfer
> Exit Sub
> vbError:
> eError
> End Sub



Sun, 08 May 2005 21:09:24 GMT  
 MS ADO Guru Needed
Hi Val, Sukesh, Richard
Using vs 2.5 & SP 5.
I got the problem solved. Problem was I was referencing back to the
frmDataTransfer after it was unloaded, and pasing the donwloaded recordset to
the class module twice. Silly me.
Process now works real neat. I can download multiple recordsets at the same
time.
The data transfer form first checks the recordset to see how many records
there are to download and increases the background fetch size for large
recordset. Saves a lot of download time.
Thanks all
Dave
Quote:

> Hi Dave,

> Which version of ADO do you have?

> --
> Val Mazur
> Microsoft MVP



> > Hi
> > I'm using a generic data transfer form to manage the downloading of
> > recordsets from a SQL Server db sitting on a web host. The form is
> > managed from a class module which manages all recordset processes.
> > For small downloads (< 100 records) adAsyncFetch is not used. For larger
> > recordsets adAsyncFetch is used to give visual feedback using a counter
> > and progressbar. The process works great until the end of
> > MyRs_FetchComplete when VB6 crashes:

> > Err message: This program has performed an illegal operation and will be
> > shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
> > 0137:1f49029c etc - and VB closes down.

> > Any advice or ideas are welcome as I'm stuck.
> > Ta
> > Dave

> > Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
> >                       adStatus As ADODB.EventStatusEnum, _
> >                       ByVal pRecordset As ADODB.Recordset)

> > If bStopped = False Then
> >     Set cAdo.Recordset = MyRs
> >     cAdo.RecordsetIsOpen = True
> >     cAdo.TidyUp
> > ElseIf bStopped = True Then
> >     Set cAdo.Recordset = Nothing
> >     bStopped = False
> > End If
> >      <-----error occurs here and vb crashes
> > End Sub

> > in the class module

> > Public Sub TidyUp()
> > On Error GoTo vbError
> >         If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
> >             If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
> >                 Set Recordset = frmDataTransfer.cAdo.Recordset
> >                 RecordsetIsOpen = True
> >                 If Not GradientPicture Is Nothing Then UpdateGradient
> >             End If
> >         End If
> >         Unload frmDataTransfer
> > Exit Sub
> > vbError:
> > eError
> > End Sub



Mon, 09 May 2005 15:33:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. An ADO.Net DataAdapter Update Philosophy Question for the MS gurus

2. MS CoolBar and Outlook Style ToolBar Sample- Guru Needed

3. Need Help From An ADO Guru

4. Need to xport SQL Stored procs to MS Excel from ADO.net

5. MS Access & ADO - Recordset needs reset

6. SQL Help Needed - ADO & MS Access

7. ADO ,MS Access and MS Excel

8. ADO ,MS Access and MS Excel

9. Curious ADO error - for the GURUs out there

10. ADO or DAO gurus ?

11. Any ADO gurus around???

12. Any ADO GURUS around???

 

 
Powered by phpBB® Forum Software