OLE DB provides interfaces for receiving notifications when events occur. These are described in
IRowsetNotify has three methods, which can be called at various times. If you want to respond to only one of these methods, you can use the
When you create the rowset, you must tell the provider that you want the returned rowset object to support IConnectionPointContainer, which is needed to set up the notification.
The following code shows how to open the rowset from an ATL object and use the AtlAdvise function to set up the notification sink. AtlAdvise returns a cookie that is used when you call AtlUnadvise.
В | Copy Code |
---|---|
CDBPropSet propset(DBPROPSET_ROWSET); propset.AddProperty(DBPROP_IConnectionPointContainer, true); product.Open(session, _T("Products"), &propset); AtlAdvise(product.m_spRowset, GetUnknown(), IID_IRowsetNotify, &m_dwCookie); |