General information
Title:
Using CursorAdapter with identity field
I created a cursor adapter to maintain the data from a SQL table.
This table has a identity field that is the primary key.
The cursor adapter is connected via ODBC and configured to use buffering row.
So, once the cursor adapter is opened (I mean, filled...) i can make a append blank and when I move to other record, the VPF send the following lines to SQL:
exec sp_executesql N'INSERT INTO "ZRicardo".."Produto" ("CodProd","DescProd","ValorUnitario") VALUES (@P1,@P2,@P3)', N'@P1 varchar(10),@P2 nvarchar(50),@P3 money', 'FFFF ', N'GGGGG ', $1111.0000
go
SELECT @@IDENTITY
go
Is iteresting that VFP not just inserted the record, but also got the Identity value and stored in some place.
That´s fine, because, after that, if you try to change this same record (without a CursorRefresh), VFP will send a UPDATE statement using the correct ID value in WHERE clause.
My question is: Once that my form is working with children record related with this primary table, I need to get this internal id value that VFP got from SQL avoinding to make a refresh in the cursor adapter.
How can I do that? Where VFP stored this value? I tried to use the OLDVAL() and CURVAL() functions but if doesn´t work.
Any suggetion?
Thanks.
Ricardo Shimoki.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only