Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT, updatable cursor and last identity value
Message
De
01/04/2010 16:32:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01458392
Message ID:
01458445
Vues:
46
>>>Hi everybody,
>>>
>>>We're using SPT and then a special program to make cursor updatable. I see this code to get the last inserted value
>>>
>>> mysqlexec("select @@identity as keyval",'csrKeyVal', program())
>>>
>>>which doesn't look entirely correct to me - who guarantees that by doing a separate query you'll get the value of the record you just inserted and not someone else in between?
>>>
>>>Is there a better way to get the latest value?
>>>
>>>Thanks in advance.
>>
>>Of course it is not correct. You cannot even guarantee it doing in the same query batch. There are other and reliable ways like:
>>
>>select scope_identitity()
>>
>>select ... from inserted
>>
>>output clause
>>
>>Cetin
>
>I don't understand how can we use them for the cursor made updatable using technique similar to Vlad's blog. In other words, there is no INSERT command, the changes are done in the cursor, then we do TABLEUPDATE. Then we need to get the ID back. How can we do this?

I don't know Vlad's blog. Ask him.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform