Void foo ()
{
Try
{
_variant_t affected=0;
_RecordsetPtr recordset_ptr=NULL;
_ConnectionPtr connection_ptr=NULL;
Recordset_ptr. CreateInstance (__uuidof (you));
Connection_ptr. CreateInstance (__uuidof (Connection));
//open the link
Connection_ptr - & gt; Open (... )
//query execution
Connection_ptr - & gt; BeginTrans ();//1
Recordset_ptr=connection_ptr - & gt; Excute (_bstr_t (" select * from table_foo "), & amp; Affected, adCmdText);
Connection_ptr - & gt; CommitTrans ();//2
VARIANT_BOOL res=recordset_ptr - & gt; BOF.//3
.
}
The catch (_com_error & amp; E)
{
E.E rrorMessage ();
}
}
Now the situation is:
If add statements 1 and 2, namely BeginTrans () and CommitTrans (), then execute a statement 3: VARIANT_BOOL res=recordset_ptr - & gt; When the BOF
Jump straight to exception: a catastrophic failure,
If the commented-out statements 1 and 2, namely BeginTrans () and CommitTrans (), so all is well,
All this is how to return a responsibility excuse me? What principle??