Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with TABLEUPDATE when saving an existing record
Message
 
To
15/04/2014 17:08:42
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01598673
Message ID:
01598681
Views:
21
Ugh, that was it. When i saw that field name i cringed a bit. Thanks for your help. It got me looking at the SQL and then the table def itself.

>Your own star :)
>
>DESC might mix up the SQL UPDATE that does the work in the background. SQL ORDER BY clause uses DESC, it's abbrev in SET ORDER and INDEX.
>
>One should not do that.
>
>My 0.02€c: I always prefix the identifiers with a letter for the type. Like cDESC. If the field is a bit readable it will not interfere with VFP internal names.
>
>Lutz
>
>>Hmmmm, i just renamed the field DESC to LABDESC in the table/view and it appears to be working.
>>
>>>WorkLab is a table. USEing the view and updating a record, i still get the "syntax error" error.
>>>
>>>
>>>USE v_worklab
>>>BROWSE
>>>REPLACE desc WITH ALLTRIM(desc)+" test"
>>>?TABLEUPDATE(.t.,.t.,"v_worklab",laerror)
>>>
>>>
>>>>Hm, does it work if you USE the view, change a record and tableupdate? Without a new record first?
>>>>
>>>>What creates the value of keyfield labpk? BTW, why not simple Integer as key? (just curious)
>>>>
>>>>worklab is a table?
>>>>
>>>>Lutz
>>>>
>>>>>>>I have a work order form that allows users to enter work order info and to populate two child tables (via grids) in order to specify labor and materials. The form uses local views. The child labor and materials views have optimistic table bufffering set (5). The "parent" single record work order local view has optimistic row buffering set (3).
>>>>>>>
>>>>>>>If i add a NEW work order and enter in child labor and material records, i can save the work order and its child information. However, when i try to EDIT an EXISTING record, by changing something in the labor or material grid, the TABLEUPDATE(.t., .t., "v_worklab",laError) fails with the error message of "syntax error". This is nothing else stored in the error array.
>>>>>>>
>>>>>>>Any ideas?
>>>>>>
>>>>>>to the view that fails.(if more then one fails, the shortest :) )
>>>>>>
>>>>>>Is it possible to show the VIEW definition (if SELECT * a DISP STRU, please) and the definition of the DBGETPROPS ?
>>>>>>DBGETPROP(lcView","VIEW","TABLES")
>>>>>>DBGETPROP(lcView,"VIEW","SENDUPDATES")
>>>>>>DBGETPROP(lcView,"VIEW","WHERETYPE")
>>>>>>DBGETPROP(lcView,"VIEW","UPDATETYPE")
>>>>>>for all fields in view:
>>>>>>DBGETPROP(lcView+".Field_X","FIELD","UPDATENAME")
>>>>>>DBGETPROP(lcView+".Field_X","FIELD","UPDATABLE")
>>>>>>DBGETPROP(lcView+".Field_X","FIELD","KEYFIELD")
>>>>>>
>>>>>>It is also a way to run through your table using GETNEXTMODIFIED and tableupdate record by record for debugging. Maybe you se somthing With the view and the target to update open one can see the changes and the records involved.
>>>>>>
>>>>>>Lutz
>>>>>
>>>>>Here is the view def:
>>>>>
>>>>>
>>>>>SELECT Worklab.labpk, Worklab.wofk, Worklab.desc, Worklab.hours,;
>>>>>  Worklab.rate, Worklab.totlab;
>>>>> FROM ;
>>>>>     rp!worklab;
>>>>> WHERE  Worklab.wofk = ( ?lnWOFK );
>>>>> ORDER BY Worklab.desc
>>>>>
>>>>>DBSetProp(ThisView,"View","SendUpdates",.T.)
>>>>>DBSetProp(ThisView,"View","BatchUpdateCount",1)
>>>>>DBSetProp(ThisView,"View","CompareMemo",.T.)
>>>>>DBSetProp(ThisView,"View","FetchAsNeeded",.F.)
>>>>>DBSetProp(ThisView,"View","FetchMemo",.T.)
>>>>>DBSetProp(ThisView,"View","FetchSize",100)
>>>>>DBSetProp(ThisView,"View","MaxRecords",-1)
>>>>>DBSetProp(ThisView,"View","Prepared",.F.)
>>>>>DBSetProp(ThisView,"View","UpdateType",1)
>>>>>DBSetProp(ThisView,"View","UseMemoSize",255)
>>>>>DBSetProp(ThisView,"View","Tables","rp!worklab")
>>>>>DBSetProp(ThisView,"View","WhereType",3)
>>>>>
>>>>>DBSetProp(ThisView+".labpk","Field","DataType","N(10)")
>>>>>DBSetProp(ThisView+".labpk","Field","UpdateName","rp!worklab.labpk")
>>>>>DBSetProp(ThisView+".labpk","Field","KeyField",.T.)
>>>>>DBSetProp(ThisView+".labpk","Field","Updatable",.T.)
>>>>>
>>>>>DBSetProp(ThisView+".wofk","Field","DataType","N(10)")
>>>>>DBSetProp(ThisView+".wofk","Field","UpdateName","rp!worklab.wofk")
>>>>>DBSetProp(ThisView+".wofk","Field","KeyField",.F.)
>>>>>DBSetProp(ThisView+".wofk","Field","Updatable",.T.)
>>>>>
>>>>>DBSetProp(ThisView+".desc","Field","DataType","C(30)")
>>>>>DBSetProp(ThisView+".desc","Field","UpdateName","rp!worklab.desc")
>>>>>DBSetProp(ThisView+".desc","Field","KeyField",.F.)
>>>>>DBSetProp(ThisView+".desc","Field","Updatable",.T.)
>>>>>
>>>>>DBSetProp(ThisView+".hours","Field","DataType","N(6,1)")
>>>>>DBSetProp(ThisView+".hours","Field","UpdateName","rp!worklab.hours")
>>>>>DBSetProp(ThisView+".hours","Field","KeyField",.F.)
>>>>>DBSetProp(ThisView+".hours","Field","Updatable",.T.)
>>>>>
>>>>>DBSetProp(ThisView+".rate","Field","DataType","N(8,2)")
>>>>>DBSetProp(ThisView+".rate","Field","UpdateName","rp!worklab.rate")
>>>>>DBSetProp(ThisView+".rate","Field","KeyField",.F.)
>>>>>DBSetProp(ThisView+".rate","Field","Updatable",.T.)
>>>>>
>>>>>DBSetProp(ThisView+".totlab","Field","DataType","N(12,2)")
>>>>>DBSetProp(ThisView+".totlab","Field","UpdateName","rp!worklab.totlab")
>>>>>DBSetProp(ThisView+".totlab","Field","KeyField",.F.)
>>>>>DBSetProp(ThisView+".totlab","Field","Updatable",.T.)
>>>>>
>>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform