Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key Generation issues.
Message
General information
Forum:
Visual FoxPro
Category:
CodeMine
Title:
Primary Key Generation issues.
Miscellaneous
Thread ID:
00930382
Message ID:
00930382
Views:
40
I am using CodeMine version 7.1.02. I am having a problem generating primary keys using the PrimaryKey() function. When two users are adding records they occasionally get Uniquness of field is violated.

I have been able to reproduce this by creating a new project and with 1 table with a numeric PK and 1 form. I add the table to the data environment and add add a grid for the table to the form. In a button I have the following code:
THISFORM.lCancel = .F.

DO WHILE !THISFORM.lCancel
	thisform.cmdatamanager.new('table1')
	thisform.cmdatamanager.Update('table1')
	DOEVENTS()
ENDDO
I have also tried:
THISFORM.lCancel = .F.

DO WHILE !THISFORM.lCancel
     thisform.new('table1')
     thisform.Save('table1')
     DOEVENTS()
ENDDO
The DOEVENTS() is to trap for the user clicking a cancel button on the form.

When I build the EXE and run this on two workstations pointing to the same DB. I get a uniqueness error.

I have tried this with the default value set for the PK and without. I really do not understand why this is happening.

Any help would be appreciated.

Thanks
Tom
Next
Reply
Map
View

Click here to load this message in the networking platform