Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting primary key when using CursorAdapter
Message
De
04/03/2006 02:31:04
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01101462
Message ID:
01101482
Vues:
13
>Check Re: Auto Refresh Key fields after insert with CA Thread #1100805 Message #1101047

Thanks, but after having looked at several messages related to that, I still haven't found what I have to do to get the IDENTITY field value. The code now looks like this. It doesn't return any error. But, I am wondering how to retrieve that IDENTITY value right after the insert.
loConnection=CREATEOBJECT('ADODB.Connection')
loConnection.Open(This.cSQLStringConnect)
loCommand=CREATEOBJECT('ADODB.Command')
loCursor=CREATEOBJECT('CursorAdapter')
loCursor.Alias='SQLExecTemp2'+GeneratePwd(20)
loCursor.DataSourceType='ADO'
loCursor.DataSource=CREATEOBJECT('ADODB.RecordSet')
loCursor.SelectCmd=This.cSQL
loCursor.DataSource.ActiveConnection=loConnection
loCommand.ActiveConnection=loConnection
loCursor.InsertCmdRefreshCmd="Select Numero from "+loCursor.Alias+" where Numero = @@IDENTITY"
loCursor.InsertCmdRefreshFieldList="Numero"
loCursor.CursorFill(.F.,.F.,0,loCommand)
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform