Ahh...using OLEDB provider? I dunno, I'd try a VFP stored procedure...
Or put a VFP COM object in charge, or use something that is locally unique, like a GUID...
>>>
>>>I was thinking along these lines as well, but we have to explicitly lock the whole table before appending a record and retriving info. Otherwise there is a small chance to get the wrong ID.
>>
>>Nadya,
>>
>>Why do you say that?
>
>What if somebody appended a record at the same time? I believe, INSERT puts implicit lock on table header. I don't recall at this moment about APPEND BLANK (but the original question was about insert anyway)...
>
>That's actually a question from somebody in another forum. Here is his(her) latest response:
>========
>I have an C# - INSERT statement on a vfp8.0 database which uses AutoIncrement. Somehow I want to retrieve the number that has been appended. In Sqlserver there is a IDENTITY that can do this but is there something for foxpro database? I know, it's C# programming but I tried my luck at the C# corner with no succes so far. Any help?
>I have made a webform in C# that works with a foxpro database. In C# I have an insert statement. Somehow I must retrieve the appended AutoIncrement value.
>
>Your post would indeed get the AutoIncrement value but how can I pass this value to C#?
>
>The problem is I have to use this value to also insert a record to a child table. Maybe I need another approach?
>========================================================
>I advised him to ask this question here and also try to use VFP stored procedures...
Steve Gibson