Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What am I doing wrong?
Message
De
03/07/1998 21:27:46
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
 
À
03/07/1998 11:05:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00113990
Message ID:
00114172
Vues:
22
>>>When I create view using the code below and make a change to the nquantity field and move on to the next record, I get a message saying that there are "no update tables specified". Any help or ideas would be greatly appreciated!
>>>
>>>store ipmasterview.keyfield to m.cpackid
>>>
>>>IF NOT INDBC('IPDVIEW','VIEW')
>>> CREATE sql view ipdview as ;
>>> SELECT Ipdetail.*,Ipclass.citemclass, Icitem.cdescript, Icitem.cstatus,;
>>> Icitem.cclass,Icitem.cprodline, Icitem.nprice;
>>> FROM amw!Ipclass, amw!Ipdetail LEFT OUTER JOIN amw!Icitem ;
>>> ON Ipdetail.citemno = Icitem.citemno ;
>>> WHERE Ipdetail.cclassid = Ipclass.keyfield AND ipdetail.CPACKID=m.cpackid ;
>>> ORDER BY Ipdetail.cclassid, Ipdetail.citemno
>>>ENDIF
>>>
>>>if not used('ipdview')
>>> sele 0
>>> use ipdview
>>>endif
>>>
>>>=CursorSetProp('Buffering',3,'ipdview') &&opt row buffering
>>>=CursorSetProp('SendUpdates',.t.,'ipdview')
>>>=CursorSetProp('UpdateType',1,'ipDview')
>>>=CursorSetProp('WhereType',3,'ipdview')
>>>=CursorSetProp('FetchAsNeeded',.t.,'ipdview')
>>>=CursorSetProp('FetchMemo' ,.t.,'ipdview')
>>>=CursorSetProp('Keyfieldlist','keyfield','ipdview')
>>>=CursorSetProp('prepared',.t.,'ipdview')
>>>=CursorSetProp('UpdatableFieldList','keyfield,cpackid,cclassid,nquantity,citemno,ddateadded,ddatechanged','ipdview')
>>>=CursorSetProp('tables','ipdetail','ipdview')
>>
>>I figured out part of the puzzle. I had to close the view after setting the properties and re-open the view before the new cursor properties were "seen". Now, the problem is the when the view is re-opened the SendUpdates property always goes to .f.
>>
>>Note: All this was done without the view designer. Once the view has been created programmatically, I used the view designer to see if I was missing anything. The "Send SQL Updates" box was not checked (verifying that it was not being saved by the programmatic changes above) and the update check box for the key field was not checked, although I did have it in the "updatefieldlist"
>>
>>sos,help,socorro,ayuto,...etc!
>>//:^o
>
>I don't see in all this where you have specified the unique key, and you have not specified update names for the updateable fields. Create a simple updateable view with the view designer, and run gendbc on it to see what I mean. IOW there are a couple more steps to get your view updateable.
>
>You also might want to check out my utilities here in the files section that allow you to produce complete code listings for a single table or view. The file is called 'gentable.zip', and the instruction for use are at the top of the code. HTH

After many hours, I finally found the solution in the manual (believe it or not!) in the DevGuide "Updating Multiple Tables in a View". Apparently, when creating a view programmatically which combines two or more tables, you have to use DBSetProp instead of CursorSetProp, the two have almost identical properties. And the example the book gave was just what I needed for a leg up.
Thanks for the input!
//:^)
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform