Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server pass thru transaction problem
Message
From
05/12/2002 11:22:30
 
 
To
04/12/2002 19:42:21
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00729697
Message ID:
00729918
Views:
22
Hmmm... thats weird, but it could be because that message is a Level 19 which is not fatal. Also could be that you sent TWO sql statements, one didn't fail. So, you may want to sent the Delete first, if that doesn't fail, send the insert, if that doesn't fail, do your commit.

Also, even if you had this set to auto transactions I believe both statements are considered a batch and WOULD be included in the same transaction anyway. (But, I could be wrong about this.)

BOb

>I am using SPT as follows:
>
>
>SQLSETPROP(nhandle,'TRANSACTIONS',2) && start manual transactions
>SQLSETPROP(nHandle,'Asynchronous',.T.) && use asynchronous processing
>
>lcCmd = "A delete followed by an insert to update a data record"
>
>lnSuccess = 0
>DO WHILE lnSuccess = 0
>   lnSuccess = SQLEXEC(nHandle,lcCmd,'SQLResults')
>ENDDO
>
>IF lnSuccess < 1
>   SQLROLLBACK(nHandle)
>ELSE
>   SQLCOMMIT(nHandle)
>ENDIF
>
>SQLSETPROP(nhandle,'TRANSACTIONS',1) && end manual transactions
>
>
>My problem is that even though an error is encountered by the SQL insert command, lnSuccess returns 1. The error is that one string that I am attempting to save is longer than the field. The Query Analyzer reports the error when I issue the SQL Commands there. Since lnSuccess is 1, I commit the transaction but the insert has failed.
>
>From Query Analyzer:
>
>Server: Msg 8152, Level 16, State 9, Line 1
>String or binary data would be truncated.
>The statement has been terminated.
>
>
>Does anyone understand why this is happening?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform