I have been having troubles with duplicate primary ID's
I am using VFP9.
The main application mostly uses cursor adapter classes to access the tables, where records are added and edited.
I have some other remote users on tablets that access the same tables to add records when they need remotely using a cut down "Tablet version" of the application.
The unique ID is an Auto Increment Integer field (Indexed)
The tablets connect to the main server database using a VPN
Typically:
Use MAINTABLE shared
select MAINTABLE
cursorsetprop("Buffering",5,"MAINTABLE")
Append Blank
Replace FIELD with VALUE
=tableupdate(.f.,.t., "MAINTABLE")
use in MAINTABLE
I think the problem arises because the connection back to the main database is perhaps not great sometimes and the users on the server add records at the same time.
I usually open the MAINTABLE at the beginning of the code run and may have to loop through a local table on the tablet doing the various updates.
What can I do to validate the unique ID prior to TABLEUPDATE?
How do I refresh the MAINTABLE on the tablet just before I append a new record?
Or should I approach things a little differently.
I do have a couple of tables that are used for just the Unique ID's for some of the tables, so it would be not to hard to modify the table to have a "ID used" field or similar and get the server to add records maybe a few thousand when needed so the tablets just retrieve the ID, not add the new records to the ID tables.
Any help would be appreciated
I am using VFP9.
The main application mostly uses cursor adapter classes to access the tables, where records are added and edited.
I have some other remote users on tablets that access the same tables to add records when they need remotely using a cut down "Tablet version" of the application.
The unique ID is an Auto Increment Integer field (Indexed)
The tablets connect to the main server database using a VPN
Typically:
Use MAINTABLE shared
select MAINTABLE
cursorsetprop("Buffering",5,"MAINTABLE")
Append Blank
Replace FIELD with VALUE
=tableupdate(.f.,.t., "MAINTABLE")
use in MAINTABLE
I think the problem arises because the connection back to the main database is perhaps not great sometimes and the users on the server add records at the same time.
I usually open the MAINTABLE at the beginning of the code run and may have to loop through a local table on the tablet doing the various updates.
What can I do to validate the unique ID prior to TABLEUPDATE?
How do I refresh the MAINTABLE on the tablet just before I append a new record?
Or should I approach things a little differently.
I do have a couple of tables that are used for just the Unique ID's for some of the tables, so it would be not to hard to modify the table to have a "ID used" field or similar and get the server to add records maybe a few thousand when needed so the tablets just retrieve the ID, not add the new records to the ID tables.
Any help would be appreciated