Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CursorAdapter with identity field
Message
From
29/05/2003 11:04:16
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Using CursorAdapter with identity field
Miscellaneous
Thread ID:
00793952
Message ID:
00793952
Views:
56
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
Map
View

Click here to load this message in the networking platform