Article View: borland.public.cppbuilder.database.multi-tier
Article #539ADO COM+ MTS UpdateBatch
From: mlesage
Date: Mon, 02 Jul 2001 13:29
Date: Mon, 02 Jul 2001 13:29
58 lines
2274 bytes
2274 bytes
The following piece of code (a Transactional Object)
works fine when it isn't the component isn't added to a COM+ application.
When added, the changes made to the database through updatebatch
aren't committed.
Does anybody have a clue how this comes ?
It would help me a lot.
When i look at the statistics of COM+ it appears as if the transaction succeeded.
--------- CODE : ------------
STDMETHODIMP TTYRAImpl::ReturnRS(LPDISPATCH* Rs)
{
try
{
TCOM_Recordset adoRs = CoRecordset::Create();
adoRs->CursorLocation = adUseClient;
adoRs->Open( "SELECT * FROM Customers", "DSN=North", adOpenStatic,
adLockBatchOptimistic, adCmdText );
*Rs = (IDispatch*)adoRs;
adoRs->AddRef();
return S_OK;
}
catch (...)
{
ShowMessage("Return Problem !");
}
return E_FAIL;
}
STDMETHODIMP TTYRAImpl::UpdateRs(LPDISPATCH Rs)
{
_Recordset* rs;
try
{
Rs->QueryInterface(__uuidof(Recordset), (void**)&rs);
TCOM_Connection cn = CoConnection::Create();
cn->ConnectionString = L"DSN=North";
cn->CursorLocation = adUseClient;
cn->Open(L"", L"", L"", -1);
rs->ActiveConnection = cn;
rs->UpdateBatch(adAffectAll);
rs->Release();
m_spObjectContext->SetComplete();
}
catch(...)
{
ShowMessage("Update Problem !");
m_spObjectContext->SetAbort();
}
return S_OK;
}
Micha๏ฟฝlo Lesage.
Technical Details
Message-ID:
<3b40771e$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.he.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fcd2b,fecee46c178533c4,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2001-07-02 06:33:59 PST From: "mlesage" <michaelo_lesage@hotmail.com> Sender: "mlesage" <michaelo_lesage@hotmail.com> Reply-To: "mlesage" <michaelo_lesage@hotmail.com> Subject: ADO COM+ MTS UpdateBatch Newsgroups: borland.public.cppbuilder.database.multi-tier X-User-Info: 194.78.30.90 194.78.30.90 NNTP-Posting-Host: 207.105.83.65 Message-ID: <3b40771e$1_2@dnews> Date: 2 Jul 2001 06:29:02 -0700 X-Trace: dnews 994080542 207.105.83.65 (2 Jul 2001 06:29:02 -0700) Lines: 58 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.he.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews