Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database relations?
Message
De
26/11/1999 10:38:34
 
 
À
24/11/1999 21:14:13
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00293872
Message ID:
00295719
Vues:
27
Hi John,

It's John again (also ) :-)

I don't see anything wrong with your view definition besides the fact that I don't see a true key. Your key is made up of custcode and shiptocode. This doesn't strike me as something that will always be unique. You should consider adding another field to customer_ship_to that will always be unique and make that your key.

I see that you are also opening both the base table and the view and buffering both....ahhh....this, my friend, is the no-no and explains a lot about the problems you are having. Before I go further, let me say that you should remove the lines opening customer_ship_to and setting a buffer mode. Just open "customer" and set it to buffermode 3 (opt. row), then open lvCustomer_Ship_to and set it to buffermode 5 (opt. table).

Now, let's look at the problems:

>A. Upon editing an existing address, the changes are accepted and are all visible instantly within my Grid. OK

OK, and this will not change if you do what I suggested.

>B. .If I remove an address by issuing a DELETE and a TABLEUPDATE(0,.T.) it removes itself from the grid; If I then re-add the same SHIPTOCODE for that Customer, I get a "Unique violation" error...this probably has something to do with my "Primary Index Key"...why do I get this? I just previously deleted it? It is actually unique.

Granted. It would be removed from the view but *not* the base table because you were buffering the base table, so the DELETE would be committed for the view but not the base table. Therefore, it *is* a unique violation.

>c. If I add a completely new SHIPTO code it is not visible within my grid. I issue a TABLEUPDATE(0,.T.) after every addition. I also issue a REQUERY("lvCustomer_Ship_To") after every TABLEUDATE(0,.T.) along with a ThisForm.grdCustomer_Ship_To.Refresh(). The data is actually stored in the bas table CUSTOMER_SHIP_TO. I checked. If I close all the forms and reopen them I see the additions. Closing the frmCustomer_Ship_To form is not enough. I must close and reopen the main frmCustomer form also.

Again, you were only updating the view and not the base table. Well...not always because of the behavior of buffermode 3 but .... change your file opens and buffers the way I suggest and this problem goes away to.
----------
John: A basic rule of thumb: When using a view, don't open the base table. And certainly don't buffer it if you absolutely have to open it.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform