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