Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Views and adding records...
Message
From
04/06/2001 08:57:16
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00514463
Message ID:
00514509
Views:
12
Chris,

What I have been doing is creating a local p-view of the table (filter by pkey = ?nMyKey) checking the pkey as the key field in update critera and checking all of the updates and checking send sql updates on the update critera tab.

Add the view to the form not the table. make your text box control source the view fields. to add a record set nMyKey to -1 (assuming your keys are all positive values) I uaslly add a property to the form like nMyKey for each views pkey. do an append blank in myview and a requery("myview"). when i save the record i add the new pkey and save it with a tableupdate(0, .f., 'myview'). if i cancel the add i just do a tablerevert(.t., 'myview'). of course you need to do the usual checks if you close the form with an appended blank record and do the tablerevert to prevent errors. to edit a record set nMyKey to the pkey value and do the requery() then the tableupdate to save the changes or tablerevert to cancle the changes...

>Hi everybody - I ask this after a lot of reading of the help files and searching through the calendar looking at posts and also a lot of "trying it out"
>
>I have a customers table. When I append blank a stored procedure adds the primary key. GREAT.
>
>I created a view based on this table - I check update criteria - update all including the primary key (not sure if I'm right or not here) and send sql updates.
>
>I have a form with textboxes bound to the view.
>
>What is the best way to add/delete records, making sure the primary key gets maintained?
>
>If I've missed posts on this I'am sorry but I have spent quite a while searching...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform