Page 1 of 1

ADO events

Posted: Tue Sep 05, 2006 5:22 am
by Rimantas
Hi !

It's needful to adopt one event in ADO objects . I found an VFP sample ,
it demonstrate what I want to do :

#DEFINE C_VFPCOMCLASS 'vfpcom.comutil'
oVFPCOM = CreateObject(C_VFPCOMCLASS)
oRecordSet = CreateObject('ADODB.RECORDSET')
oRecordSet.CursorType = 3 && adOpenStatic
oRecordSet.LockType = 1 && adLockReadOnly
oRecordSet.Open('SELECT * FROM AUTHORS', + ;
'Provider=sqloledb;Server=MYSQL1;' + ;
'Initial Catalog= pubs;UId=sa;PWD=; ')
oEvents = CreateObject('adoevents')
nError = oVFPCOM.BindEvents(oRecordSet, oEvents)
oRecordSet.MoveNext

DEFINE CLASS adoevents AS Session
PROCEDURE WillMove(adReason, adStatus, pRecordset)
WAIT WINDOW 'Moving one record...' NOWAIT
ENDPROC
ENDDEFINE

The problem is that this example is adapted to VFP COM object . So my
question it will second : can I manage events of recordsets without COM
object ( as in sample ) ? Only with ADO objects ?

If yes , can you show some source how to do that ? It's needful to
recognize movings events on recordset and then to do some things .

Many thanks in adcvance ! With best regards ! Rimantas