>Thanks, but that doesn't help me. I said that I was aware of that function but I get errors when trying to use it in .Net with an OLEDB command object.
>
Then you can only lock the table and get the max id.
>
>>>I'm writing a business object in .Net that is using a VFP database container with autoincrement primary keys. I want to send an INSERT statement using an OLEDB command and get back the value that was assigned to the auto increment field. I know about the GETAUTOINCVALUE() function that returns this value. The problem is getting the value back to my .Net class. I looked in the help file and this function is not listed in the "Supported VFP Commands" or the "Unsupported VFP Commands".
>>>
>>>When I do this with a SQL Server database I can send something like this in a single command object:
>>>
>>>
>>>INSERT INTO tablename (fieldlist) VALUES (valuelist)
>>>IF @@ROWCOUNT < 1
>>> SELECT -1 AS [SCOPE_IDENTITY]
>>>ELSE
>>> SELECT Convert(INT, SCOPE_IDENTITY()) AS [SCOPE_IDENTITY]
>>>
>>>
>>>How can I do something similar with VFP?
>>
>>
>>GETAUTOINCVALUE([nDataSessionNumber | 0])
>>