Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SqlRollback and TableUpdate
Message
From
16/10/2003 14:03:11
Carla Silva
Http - Produtos Informaticos, Lda.
Odivelas, Portugal
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SqlRollback and TableUpdate
Miscellaneous
Thread ID:
00839421
Message ID:
00839421
Views:
64
Hi to all,

I have a problem with SQlRollback, do not work with tableupdate and remote views,i´m just look over the code many times and i think it´s everting ok, but..

=cursorsetprop("SendUpdates",.t.,lctablename1)
=cursorsetprop("SendUpdates",.t.,lctablename2)

this.cs_connection=cursorgetprop("connecthandle",lctablename1)
=SQLsetprop(this.cs_connection,"Displogin",3)
=SQLsetprop(this.cs_connection,"transactions",2)

if !Tableupdate(.t.,.t.,lctablename1)
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN && erro de ODBC
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)

if SQLRollBack(this.cs_connection) < 0
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN && erro de ODBC
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)
=tablerevert(.t.,lctablename1)
=tablerevert(.t.,lctablename2)

=cursorsetprop("SendUpdates",.f.,lctablename1)
=cursorsetprop("SendUpdates",.f.,lctablename2)
return .f.
endif
else
if !Tableupdate(.t.,.t.,lctablename2)
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN && erro de ODBC
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)

if SQLRollBack(this.cs_connection) < 0
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN && erro de ODBC
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)
=tablerevert(.t.,lctablename1)
=tablerevert(.t.,lctablename2)

=cursorsetprop("SendUpdates",.f.,lctablename1)
=cursorsetprop("SendUpdates",.f.,lctablename2)
return .f.
endif
else
if SQLcommit(this.cs_connection) < 0
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)
if SQLRollBack(this.cs_connection) < 0
=AERROR(aErrArray)
lnUpdateError=aErrArray[1]
lcErrMsg=aErrArray[2]
IF lnUpdateError=1526 AND !ISNULL(aErrArray[5])THEN && erro de ODBC
lnUpdateError=aErrArray[5]
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
else
lcMsg=STRTRAN(lcErrMsg,"|1",LTRIM(STR(lnUpdateError)))
endif
=MESSAGEBOX(lcMsg,mb_iconexclamation,errortitle_loc)
endif
=tablerevert(.t.,lctablename1)
=tablerevert(.t.,lctablename2)

=cursorsetprop("SendUpdates",.f.,lctablename1)
=cursorsetprop("SendUpdates",.f.,lctablename2)
endif

=cursorsetprop("SendUpdates",.f.,lctablename1)
=cursorsetprop("SendUpdates",.f.,lctablename2)
=SQLsetprop(this.cs_connection,"transactions",1)
endif
endif

in this example with the SQLROLLBACK the lctablename1 and lctablename2 do not rollback to is´t original state.

Thanks
Carla Silva
Next
Reply
Map
View

Click here to load this message in the networking platform