Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Transaction only work in storage procedure?-Help

4 posts in General Discussion Last posting was on 2004-03-09 12:53:07.0Z
sen Posted on 2004-03-08 13:51:56.0Z
Sender: 8e5.404c74ff.1804289383@sybase.com
From: Sen
Newsgroups: ianywhere.public.general
Subject: Transaction only work in storage procedure?-Help
X-Mailer: WebNews to Mail Gateway v1.1s
Message-ID: <404c7ab6.92e.846930886@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 8 Mar 2004 05:52:55 -0800, 10.22.241.42
Lines: 25
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 8 Mar 2004 05:50:08 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 8 Mar 2004 05:51:56 -0800
X-Trace: forums-1-dub 1078753916 10.22.108.75 (8 Mar 2004 05:51:56 -0800)
X-Original-Trace: 8 Mar 2004 05:51:56 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2736
Article PK: 6209

I'm using SQLanywhere 8.0 as database ,ODBC connection and
VFP as frontend
in my code(VFP):
lncon=SQLCONNECT("PI") <-data source name is PI
SQLEXEC(lncon,"BEGIN TRAN")
SQLEXEC(lncon,"UPDATE table1 SET field1=field1-100")
lret=SQLEXEC(lncon,"UPDATE table2 SET field1=field1-100")
IF lret<>0 <-error occure MUST ROLLBACK value changes in
table1
SQLEXEC(lncon,"ROLLBACK")
ELSE
SQLEXEC(lncon,"COMMIT TRAN")
ENDIF

from what I get now it seem I miss something, it's seem
BEGIN TRAN does not effect at all, after UPDATE1 success dan
UPDATE2 faild ROLLBACK does not rollback value in field1.
With the similar code it did work in storage procedure, but
I really need to run the code from VFP

Please Help I have tried it several days but still haven't
succes, I am really desperated.

TIA
SEN


Reg Domaratzki Posted on 2004-03-08 14:42:36.0Z
From: "Reg Domaratzki" <Spam_bad_rdomarat@ianywhere.com>
Newsgroups: ianywhere.public.general
References: <404c7ab6.92e.846930886@sybase.com>
Subject: Re: Transaction only work in storage procedure?-Help
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: rdomarat-pc.sybase.com
X-Original-NNTP-Posting-Host: rdomarat-pc.sybase.com
Message-ID: <404c865c@forums-1-dub>
Date: 8 Mar 2004 06:42:36 -0800
X-Trace: forums-1-dub 1078756956 172.31.143.163 (8 Mar 2004 06:42:36 -0800)
X-Original-Trace: 8 Mar 2004 06:42:36 -0800, rdomarat-pc.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2738
Article PK: 6208

Does Visual FoxPro do a commit after each statement?

--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL

<Sen> wrote in message news:404c7ab6.92e.846930886@sybase.com...
> I'm using SQLanywhere 8.0 as database ,ODBC connection and
> VFP as frontend
> in my code(VFP):
> lncon=SQLCONNECT("PI") <-data source name is PI
> SQLEXEC(lncon,"BEGIN TRAN")
> SQLEXEC(lncon,"UPDATE table1 SET field1=field1-100")
> lret=SQLEXEC(lncon,"UPDATE table2 SET field1=field1-100")
> IF lret<>0 <-error occure MUST ROLLBACK value changes in
> table1
> SQLEXEC(lncon,"ROLLBACK")
> ELSE
> SQLEXEC(lncon,"COMMIT TRAN")
> ENDIF
>
> from what I get now it seem I miss something, it's seem
> BEGIN TRAN does not effect at all, after UPDATE1 success dan
> UPDATE2 faild ROLLBACK does not rollback value in field1.
> With the similar code it did work in storage procedure, but
> I really need to run the code from VFP
>
> Please Help I have tried it several days but still haven't
> succes, I am really desperated.
>
> TIA
> SEN


Breck Carter [TeamSybase] Posted on 2004-03-08 15:24:03.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Transaction only work in storage procedure?-Help
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <rl3p40l21m5dn8qndt37fenqpdrte49mqe@4ax.com>
References: <404c7ab6.92e.846930886@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 8 Mar 2004 07:24:03 -0800
X-Trace: forums-1-dub 1078759443 64.7.134.118 (8 Mar 2004 07:24:03 -0800)
X-Original-Trace: 8 Mar 2004 07:24:03 -0800, bcarter.sentex.ca
Lines: 44
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2739
Article PK: 6210

Do not bother with BEGIN TRAN. Check to make sure there is no client
side "auto commit" option set on, and check the database to confirm
that the CHAINED database option remains set to the default 'ON'. You
can use the ISQL SET command to check all options. Note: do not be
concerned by the database AUTO_COMMIT option, it *only* applies to
ISQL; you should be concerned with whatever client-side auto commit
setting is available in your programming environment

Breck

On 8 Mar 2004 05:51:56 -0800, Sen wrote:

>I'm using SQLanywhere 8.0 as database ,ODBC connection and
>VFP as frontend
>in my code(VFP):
>lncon=SQLCONNECT("PI") <-data source name is PI
>SQLEXEC(lncon,"BEGIN TRAN")
>SQLEXEC(lncon,"UPDATE table1 SET field1=field1-100")
>lret=SQLEXEC(lncon,"UPDATE table2 SET field1=field1-100")
>IF lret<>0 <-error occure MUST ROLLBACK value changes in
>table1
> SQLEXEC(lncon,"ROLLBACK")
>ELSE
> SQLEXEC(lncon,"COMMIT TRAN")
>ENDIF
>
>from what I get now it seem I miss something, it's seem
>BEGIN TRAN does not effect at all, after UPDATE1 success dan
>UPDATE2 faild ROLLBACK does not rollback value in field1.
>With the similar code it did work in storage procedure, but
>I really need to run the code from VFP
>
>Please Help I have tried it several days but still haven't
>succes, I am really desperated.
>
>TIA
>SEN

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


sen Posted on 2004-03-09 12:53:07.0Z
Sender: 3646.404dbda4.1804289383@sybase.com
From: Sen
Newsgroups: ianywhere.public.general
Subject: Re: Transaction only work in storage procedure?-Help
X-Mailer: WebNews to Mail Gateway v1.1s
Message-ID: <404dbe33.364e.846930886@sybase.com>
References: <404c7ab6.92e.846930886@sybase.com><rl3p40l21m5dn8qndt37fenqpdrte49mqe@4ax.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 9 Mar 2004 04:53:07 -0800
X-Trace: forums-1-dub 1078836787 10.22.241.41 (9 Mar 2004 04:53:07 -0800)
X-Original-Trace: 9 Mar 2004 04:53:07 -0800, 10.22.241.41
Lines: 2
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2745
Article PK: 6213

Reg, Breck thanks
I will try it again