COM callbacks in Python

Dan danbrwn at gmail.com
Thu Mar 23 22:13:47 CET 2006


I need to register for a COM  callback under Windows. I am using an ADO
recordset interface like this:

import win32com.client
import time
connect = win32com.client.Dispatch("ADODB.Connection")
recordset = win32com.client.Dispatch("ADODB.Recordset")
connect.Open("Driver={SQLServer};Server=devserver;Database=VidVisitation;UID=sa;PWD=;")
datestring = time.strftime("%m/%d/%Y")
sql = "Select * from VisSchedule where SDATE='" + datestring +"'"
recordset.Open(sql,connect)

Now I want to receive events for the recordset when the recordset
changes. Here is the IDL for the event:
[id(0x0000000e)]
HRESULT RecordsetChangeComplete(
                [in] EventReasonEnum adReason,
                [in] Error* pError,
                [in, out] EventStatusEnum* adStatus,
                [in] _Recordset* pRecordset);

How do I wire up the recordset I have created to receive this event?




More information about the Python-list mailing list