Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Conflict
Message
From
20/10/1998 04:36:17
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Update Conflict
Miscellaneous
Thread ID:
00148405
Message ID:
00148405
Views:
62
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
Next
Reply
Map
View

Click here to load this message in the networking platform