Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting records
Message
 
 
À
03/05/2000 22:14:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00365920
Message ID:
00365950
Vues:
14
>I'm having a little trouble with primary keys and remote view to SQL 7 server.
>
>If I have a parent table and I APPEND BLANK to the view I don't have a primary key yet because SQL hasn't generated the key yet. That means I can't tie in any child records. To compound the problem my view needs to be parameterized on the key. The irony is I can't requery my view to get the key because the parameter to the view is that key.
>
>If anyone knows what I'm talking about and can help, message me a soon as you can.
>
>thanks,
>
>Greg Moss
>www.siteproposals.com

You can handle this in a couple of ways (that I know of).

First you could handle it manually. Set up a KEY table within SQL Server and create a stored procedure (or manual code) to retrieve the next available key given a table name. With the key, you can then retrieve keys for all your child records and use the parent key already retrieved.

Second, you could set up your primary keys as Identity fields. When you append blank, issue a tableupdate() and then immediately issue a SELECT @@identity to get the last identity value assigned. You then use this as your parent key.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform