Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updates with childgrid
Message
From
03/12/1997 10:54:21
 
 
To
03/12/1997 10:12:44
Per Strid
Ps Optisk Data
Uppsala, Sweden
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00063560
Message ID:
00063574
Views:
52
>I have created a table in a databasecontainer that uses a function to set a randomnumber as a unique index (customer ID). This was described in Sander, Brentnall, Gunn's book The visual guide to VFP 3.0. Now however, I add a childgrid to my form with orders placed by these customers. Now when I try to add something, VFP asks if I want to add a record to just the parenttable, only the childtable or both. If I want to add only to the child (new order) everything works out fine. But if I want to add a customer (parentrecord), VFP seems to miss my function to create a unique new cusomer ID, so this ends up blank. This is no good since my next uppdate ends up with a unique index error. How do I solve this?

I am not really clear on what is happening in your app, but if I may, I have a sugggestion anyway. If you are just starting your application or framework, I would advise rethinking your unique key strategy. Currently, the best (and most widely used) way that we have to deal with this is a function in the stored procedures of your database that retrieves a unique value from a table that that stores the next unique key for each table. By placing the name of the function in the default value of the primary key in your table, unique keys are automatically added whenever a record is added. The Tastrade example that ships with VFP 5.0 has a good example of this to start with. Getting a solid footing regarding unique keys often prevents problems like the one you are having. HTH
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform