>Based on the input from Thomas Ganss I am checking the code on my Cursor Adapter. And I find that the PK value set in the Cursor Adapter is based on the following code:
>
>
>this.ca_object.InsertCmdRefreshFieldList = ALLTRIM(tcIdentityField)
>this.ca_object.InsertCmdRefreshCmd = "SELECT @@IDENTITY"
>
>
>I thought that @@IDENTITY will get the last identity on the "current session". Therefore, I thought that it should not get the value of new identity created by another user (that is, another session). Am I wrong?
>
>UPDATE. This customer who is giving me the problem (or the other way around), I think, is using Terminal Server or some similar technology. So I am thinking that - maybe - all users, as far as SQL Server is concerned, are using the same session. Another thing to explore.
The most reliable way is to use OUTPUT clause of the INSERT command. I don't remember if we already have VFP samples here in the forum of how to do that, I'd try that.
If it's not broken, fix it until it is.
My Blog