Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why the varible can not got value?
Message
 
 
To
12/11/2003 05:51:06
Michale Chen
Shijiazhuang ZhiYuan Crop.
Shijiazhuang, China
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00848735
Message ID:
00849117
Views:
26
Michale,

>Hello David, my code is like this could you give me any advice--why the varible 'lcfield' can't got vallue?

Well for one thing there is a bunch of conditional code in there. Are you even sure the loop is running? I don't what happens on the line SQLExec( hConnect,'IF @@TRANCOUNT > 0 ROLLBACK') it's quite likely that it's changing your current workarea to sqlresult.

You should put a SET STEP ON right before the BEGIN TRANSACION and step through the code in the debugger, use the trace and locals windows to examine what is happening.

>LPARAMETERS hConnect, lview
>sele &lview
>
>SQLSETPROP(hConnect,'transactions',2)
>
>BEGIN transaction
>ISuccess=TABLEUPDATE(.T.,.f.)
>IF ISuccess=.F.
>
> SQLExec( hConnect,'IF @@TRANCOUNT > 0 ROLLBACK')
> ROLLBACK
> ¡¡=AERROR(aErrors)
> DO CASE
> CASE aErrors[1,1]=1585
>
> local lnfields
> lnfields = FCOUNT()
> DIMENSION laconflict[lnFields]
> local nnextmodified
> nNextModified = GETNEXTMODIFIED(0)
> DO WHILE nNextModified <> 0
> GO nNextModified
> FOR nField=1 to FCOUNT()
> lOCAL lcfield
> ¡¡lcField=field(nField)
>
>.......
>
> nNextModified =GETNEXTMODIFIED(nNextModified)
> ENDDO
> ¡¡¡¡¡¡¡¡=TABLeupdate(.T.,.t.)
> SQLCOMMIT(hConnect)
> OTHERWISE
> MESSAGEBOX("unknowing error:"+ STR(aErrors[1,1]),'system information')
> RETURN .f.
> ENDCASE
>ELSE
> LOCAL nns
> nns=SQLCOMMIT(hConnect) SQLExec(hConnect, 'IF @@TRANCOUNT > 0 COMMIT')
>
> IF nns=1
> =messagebox('sucessfully saved','system information')
> END transaction
> RETURN .t.
> ELSE
> END transaction
> ENDIF
>ENDIF
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform