Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using CursorAdapter with identity field
Message
De
29/05/2003 13:55:31
 
 
À
29/05/2003 11:04:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00793952
Message ID:
00794070
Vues:
39
>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.

Hi Ricardo,

CursorAdapter doesn't query IDENTITY value.
Are you sure you are using ODBC data source type?

Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform