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