So here's the deal -
I'm a novice at using ADO, (not to mention database usage in general) and
have spent much nashing of teeth looking for the elusive C++ examples that
exist under rocks here and there in amongst the VB and HTML examples. I've
managed to piece together enough information to get most of what I want to
do done, however, my attempts at using the transaction functions have as of
yet been unsuccessful.
I'm runnning NT 4.0 service pack 4.
Developing with VC++ 6.0.
I have Access 97 installed (my database needs at this point are small...).
And to the best of my knowledge I have installed the lastest and greatest
rendition of ADO - or so the web download page implied.
When I try and use 'BeginTrans' - an exception is thrown and I'm able to
extract the following error:
"Description = [Microsoft][ODBC Microsoft Access 97 Driver]Operation
invalid at this time ".
I've decided that either I have the wrong drivers, and they don't support
the requested behavior - (but I believe them to be the most recent
drivers...?) OR I'm somehow using the method incorrectly (see code snipit
below).
Has anyone experienced this? What obvious thing am I not seeing?
Any comments would be greatly appreciated!
Thanx,
Kevin Pumarlo
P.S
I'm using the VC++ extensions for ADO - most handy given the alternative...
CActionTableRs rsActionTable;
HRESULT hRes;
IADORecordBinding* pIrbRs1 = NULL;
// Trap any error/exception
try
{
//------------------------
// Open Connection Object
//------------------------
// Create Connection Object - Conn1
Conn1.CreateInstance( __uuidof( Connection ) );
Conn1->ConnectionString = bstrAccessConnect;
Conn1->Open( bstrEmpty, bstrEmpty, bstrEmpty, -1 );
//-----------------------------------
// Open Parameterized Command Object
//-----------------------------------
// Create Command Object
Cmd1.CreateInstance( __uuidof( Command ) );
Cmd1->ActiveConnection = Conn1;
// Open Recordset Object - Rs1
Rs1.CreateInstance( __uuidof( Recordset ) );
Rs1->Open(_bstr_t(bstrTable),
_variant_t(Conn1.GetInterfacePtr()), adOpenKeyset,
adLockOptimistic, adCmdTable);
Conn1->BeginTrans();
**** !!!! At this point a '_com_error' exception is thrown yielding the
afore mentioned description.