Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Windows Application / VFP database
Message
De
20/12/2003 06:32:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00860645
Message ID:
00860954
Vues:
14
>Hi,
>
>Right now I am working on a windows application project written in c#. My database is a VFP 8.0 database with some tables having an autoincrement integer datafield. In my application I use some queries to retreive some data. These queries work fine. But now I want to insert some records in my tables. How can I retreive the last generated identifier from my table?
>
>Using SQL server it can be done like this:
>BEGIN TRANSACTION
>INSERT INTO table1 (fields) VALUES(values);
>SELECT @@IDENTITY as id
>COMMIT
>
>TIA,
>
>Sander

If you do it the same way you did in SQL server sample you could call a stored proc that'd insert and return you the last id using ExecuteNonScalar.
Otherwise AFAIK there is nothing in VFP that correspond to @@IDENTITY.
I'd use GUID as a primary key rather than autoinc values. Then you could create the value and send as updatable.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform