Sunday, March 11, 2012

Connection for the ADO RecordSet

Hi! All,

I have an old ado application like following:

pCadoCon = new CADOConnection;

pCadoCon->Open (_T"driver={...A OEM driver...}; UID=..;PWD=....", _T (""), _T (""));

//some OEM driver unlocking code

pCadors = new CADORs;

pCadors->Open (_T"select foo from bar", pCadoCon->m_lpDispatch, eCursor); //SQL: a select statement here

The CADOConnection and CADORs are ADO connection, RecordSet wrapper classes created with ClassWizard.

I successfully open an ADO connection using the OEM driver by this DSN less way, and then passed it to ADO Recordset. From ODBC trace, I found that under the cover of the ADO, this connection is used to execute the select statement, but after that it automatically opens an other connection. I do not know why and is it possible to disable this?

I suspect it's opening another connection to provide a back channel to post updates to a scrollable, updatable rowset. Can it be disabled? Ah, sure. Open a ROFO Recordset.

No comments:

Post a Comment