Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Buffering, Views and primary keys
Message
From
23/02/2000 00:29:04
Jill Derickson
Software Specialties
Saipan, CNMI
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00335702
Message ID:
00335815
Views:
18
Whew! glad to hear that it's not as straightforward as I expected...just returned from almost a month off, and my brain is fuzzier than usual (spent a great 2 weeks in Bali...which is about as far away from VFP as you can get).

>A common dilema for me as well. Normally, I have views whose PK field is not updatable. However, if I need to know the key when I add a new record to the view [mainly because it is going to be a FK for another view for which I am also adding records], I have to generate the ID first for the view. One option is to use DBSetProp('mytable.mypkfield', 'Field', 'Updatable', .T.) which is fine if you create a temp DBC on each user's computer. OTherwise it is not so good a practice.
>
>If you populate the PK without that field being updatable, a second PK will be generated when you issue TableUpdate(). This too is very bad. For you, since you are using a local view, you need to deal directly with the table first. Then use the view to retrieve the new record[s]. For me, I am using remote views, so I have to have 2 views -- 1 with the PK field updatable and 1 with the PK non-updatable.

I think I've attempted to deal with this before, when I was newer to views, and I just gave up.

Soooo, it looks like, in general, when INSERTing records, an updateable view should not be used...just INSERT into the underlying table, then requery the view and use it for updating existing records? seems to work for me at this point, but now I have another problem...will go post another message.

Thanks for your help...it was a BIG help. J
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform