Monday, March 12, 2012

OLE DB: How to set the property DBPROP_SSCE_TRANSACTION_COMMIT_MODE correctly?

Hello,

because of the fact that the database sdf-file is stored on a cf-card, i want that all commit transactions will be flushed to the file immediately.
So i want to open the database with the above property. But i don't know the type and value i have to place into the variant. The following code fragment gave me the error "DB_S_ERRORSOCCURRED when i try to set the property with IDBInitialize::SetProperties() :

//Initialize property DBPROP_SSCE_TRANSACTION_COMMIT_MODE
dbprop_ssce_session[0].dwPropertyID = DBPROP_SSCE_TRANSACTION_COMMIT_MODE;
dbprop_ssce_session[0].dwOptions = DBPROPOPTIONS_REQUIRED;
dbprop_ssce_session[0].vValue.vt = VT_I4;
dbprop_ssce_session[0].vValue.lVal = DBPROPVAL_SSCE_TCM_FLUSH;

//Initialize property set DBPROPSET_SSCE_SESSION
dbpropset[1].guidPropertySet = DBPROPSET_SSCE_SESSION;
dbpropset[1].rgProperties = dbprop_ssce_session;
dbpropset[1].cProperties = 1;
//(there is another property for the path not shown here)

I would appreciate it when someone out there knows the answer and could tell me.

Kind regards,
Andre

Your code looks ok. I use the ATL OLE DB Consumer Templates for this and they also set the colid member to DB_NULLID. This is the only thing I see missing from your code.

Other than this, I would also look at the OLE DB error parameters to get more details.

|||

Every thing is okay except that you are setting the property on IDBInitialize. This is a session related property and so should be set using ISessionProperties.

If the question is answered, please mark it as answered.

Thanks

Raja

|||Thanks Raja,

that was exactly the crux of the matter!

Kind regards,
Andre

No comments:

Post a Comment