The rowset full functionality is either preserved or rowset enters into zombie state, after completing a transaction.

If the rowset needs to be preserved after committing a transaction, to add or fetch new rows, delete or update existing, the cursor type must be explicitly set to use server side cursor in conjunction with preserve rowset after commit (DBPROP_COMMITPRESERVE) setting.

 While accessing the rows in the rowset after commit generates following error, If the rowset was created with preserve after commit property, but not using server side cursor,

 HRESULT  = -2147418113

Error Source:      Microsoft SQL Server Native Client 10.0

Error Description: The object is in a zombie state. An object may enter a zombie state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet released. SQLSTATE and SQLCODE not supplied

 

The reason is –

Either default cursor type or client side cursor does not preserve cursor, even with preserve rowset after commit setting.  Hence, use the server side cursor in conjunction with preserve rowset after commit to add or fetch new rows and delete or update existing rows after committing a transaction.

 

- Configuration to preserve the cursor after committing a transaction 

   rgProperties[DBPropInddex].dwPropertyID   = DBPROP_COMMITPRESERVE;

   rgProperties[DBPropInddex].dwOptions      = DBPROPOPTIONS_REQUIRED;

   rgProperties[DBPropInddex].colid          = DB_NULLID;

   rgProperties[DBPropInddex].vValue.vt      = VT_BOOL;

   rgProperties[DBPropInddex].vValue.boolVal = VARIANT_TRUE;

  

-  Configuration to use the Server side cursor

   rgProperties[DBPropInddex].dwPropertyID   = DBPROP_SERVERCURSOR;

   rgProperties[DBPropInddex].dwOptions      = DBPROPOPTIONS_REQUIRED;

   rgProperties[DBPropInddex].colid          = DB_NULLID;

   rgProperties[DBPropInddex].vValue.vt      = VT_BOOL;

   rgProperties[DBPropInddex].vValue.boolVal = VARIANT_TRUE;