Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update Conflict
Message
De
20/10/1998 10:11:40
 
 
À
20/10/1998 04:36:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00148405
Message ID:
00148466
Vues:
20
>Hi!
>What is an Update Conflict and How do I aviod it.
>
>I am trying to put my database on a SQL Server.
>
>When Ever I delete a record or Save I get an Update Conflict.
>
>It's to do with my logging function below.
>But I read the help and I got that I should do a TABLEUPDATE(.T.)
>to force the update:
>
>Here's the function thanks for any advice!
>
>FUNCTION UpdatePdmLog
>
> PARAMETERS cDB,cType,cMainkey,cOldLinekey,cNewLineKey,cData,cStatus1,cStatus2,cAdmStatus,cAdmStatu2,cAdmCode,nRec
>
> LOCAL nLognum, cAlias, cField1, cField2, cLastEdit1, cLastEdit2, cOldDelete
>
> cAlias = ALIAS()
>
> =OpenDbf("PDMLOG")
>
> SET ORDER TO TAG lognum
>
> GO BOTTOM
>
> nLognum = pdmlog.lognum + 1
>
> IF NOT EMPTY(cData)
>
> SELECT (cDB)
>
> IF cType = "Delete"
> cOldDelete = SET("DELETED")
> SET DELETED OFF
> GO nRec
> ENDIF
>
> IF RLOCK()
>
> cField1 = cDB + ".lastedit1"
> cField2 = cDB + ".lastedit2"
>
> cLastEdit2 = &cField1
> cLastEdit1 = prefsall.pdmname + STR(nLognum)
>
> REPLACE &cField1 WITH cLastEdit1,;
> &cField2 WITH cLastEdit2
>
> =TABLEUPDATE(.T.)
>
> UNLOCK
>
> IF cType = "Delete"
> =GetNewLData(nRec)
> ELSE
> =GetNewLData(RECNO())
> ENDIF
>
> cData = GetData(cType)
>
> ENDIF
>
> IF cType = "Delete"
> SET DELETED &cOldDelete
> ENDIF
>
> SELECT pdmlog
>
> cData = SUBSTR(cData,2)
>
> ENDIF
>
> INSERT INTO pdmlog (lognum, USER, pdmname, TYPE, DATABASE, DATE, TIME, mainkey, olinekey, nlinekey, ;
> DATA, status1, status2, admstatus,admstatus2, admcode) ;
> VALUES (nLognum, cInit, prefsall.pdmname, cType, cDB, DATE(), TIME(), cMainkey, cOldLinekey, cNewLineKey, ;
> cData, cStatus1, cStatus2, cAdmStatus,cAdmStatu2,cAdmCode)
>
> =TABLEUPDATE(.T.)
>
> IF ! EMPTY(cAlias)
> SELECT (cAlias)
> ENDIF
>
> RETURN

If you make a Update Trigger Coding, you are not allow to move the updating cursor to another record!!!

If you need to do some check on same table, pls re-open it with different alias and check it!

if you want to get an example on trigger handling, you're welcome to download the WorkLog V1.10 in File Section - (VFP in general)

p.s. You need to take care on Trigger Coding, if there is any error on it,
you will totally unable to update records!! (Very Trouble Problem!)
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform