Article View: borland.public.cppbuilder.database.multi-tier
Article #336how to use transaction correctly?
From: Went Guo
Date: Fri, 22 Feb 2002 16:14
Date: Fri, 22 Feb 2002 16:14
35 lines
1884 bytes
1884 bytes
Hi all,
I use bcb5.0 and sqlserver2000. When I update many tables, I use
transaction. But I find there are many errors occur when use "Rollback". I
use "dbgrid" or "dbedit" edit these datasets. these datasets CachedUpdates
set true. After finish edit, I will post these edits through another
datasets.
{
db->StartTransaction();
try
{
...
qry1_hd->Post();
qry1_ln->Post();
qry2_hd->Post();
qry2_ln->Post();
db->Commit();
}
catch(...)
{
db->Rollback();
}
}
if these datasets all posted successfully, there is no any error occur. but
there is one query cannot post (et. disobey rule) and occur an error, the db
will rollback. Now I back to edit the error data. But when I do any
operation , there is another error occur. Even I shut down this Application,
the error still occur!
Would you tell me why? How to avoid these errors? Thanks a lot.
gwfa
2002.2.22
Technical Details
Message-ID:
<3c76696c_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,4c8ffb823398f935,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2002-02-22 08:04:13 PST From: "Went Guo" <gwfa@163.com> Newsgroups: borland.public.cppbuilder.database.multi-tier Subject: how to use transaction correctly? Date: Sat, 23 Feb 2002 00:14:59 +0800 Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 61.142.77.46 Message-ID: <3c76696c_2@dnews> X-Trace: dnews 1014393196 61.142.77.46 (22 Feb 2002 07:53:16 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews