>>>Greetings,
>>>
>>>We have a system that uses VFP databases/tables. To keep track of the next ID for a given table we use the typical structure...
>>>
>>>TableName C(20)
>>>NextID I
>>>
>>>In VFP client apps incrementing the key is easy with code like...
>>>
>>>
>>>Parameters lcTablename
>>>
>>>IF !USED("id")
>>> use p:\id in 0
>>>ENDIF
>>>select id
>>>locate for id.tablename = lcTablename
>>>IF !EOF()
>>> if rlock()
>>> lnNextkey = id.nextid
>>> replace id.nextid with lnNextkey + 1
>>> endif
>>>ENDIF
>>>...etc.
>>>
>>>
>>>Now we are building a .NET winform application in C#. Hooking up to the tables were easy enough but now we are struggling to find a 'best practice' to incrementing the keys. We can increment using ADO but there is no record locking so there is a possibility of duplicate keys if many users are utilizing the application.
>>>
>>>I'm posting here in the VFP forum becuase it is a unique problem to VFP. Any help would be greatly appreciated.
>>>
>>>Greg
>>
>>rlock() is available to VFPOLEDB when used in an SP.
>>Cetin
>
>Thanks for the help! Do you know of any articles that would assist in implementing this?
I use the help file that ships with VFP:)
Cetin