Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO / VFP
Message
De
24/10/1998 11:25:42
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
 
 
À
24/10/1998 08:51:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00150131
Message ID:
00150146
Vues:
17
When you start to use ODBC or OLE-DB providers you lose the ability to declare specific locks on records like you would in VFP. Buffering is always optimistic.

The answer is to make the primary key assigning part of the stored procedures of the database. SQL Server does with a datatype called IDENTITY, which is an automatically auto-incremented integer field.

To do this in VFP, in the default value box for the field in the table with an auto-incremented primary key place a function call like newid(). Then in the stored procedures for the database, add a function newid(). The newid() function is responsible for getting the next key. A good idea is to create a table with two fields: TABLENAME and KEYVALUE, for example. For sake of argument, let's call the table IDENTITY. Newid would look something like this (simple example):

FUNC newid()
LOCAL nOldSel
nOldSel=SELECT()
IF !USED(mydatabase!identity)


>We are using ado to connect databases over the internet
>
>We have a problem with defining new key's using ado
>
>Normally we have an extra databases with the latest en highest
>keys per table.
>
>If we create a new key we lock the record and create a new keynumber
>
>What is the best way to do this with ado example please.
>
>Kind regards
>
>
>Jan Dorresteijn
Eric Shaneson
Cutting Edge Consulting
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform