Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote View Update - Error

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I have an existing Remote View into an Informix backend.

In general the Remote View works well for retrieving data. But now I want to dynamically modify the Remote View to temporarily enable Updates/Inserts to the backend.

I have the following code to modify the individual field Update Criteria parameters.

Code:
* -- Database Already OPEN Here --
*    Remote View itself is NOT in USE yet
*        mcLeadView = Name of Remote View
*
* -- Code To Modify Remote View Update Parameters --
SELECT FieldList  && Ref Table containing View Field names
SCAN
   mcFieldName = ALLTRIM(FieldList.FIELD)
   DBSETPROP((mcLeadView + "." + mcFieldName), 'Field','UpDatable',.T.)
ENDSCAN
DBSETPROP(mcLeadView,'View','SendUpdates',.T.)
At this point if, for debug purposes, I go into the MODIFY VIEW &mcLeadView and actually look at the Remote View Update Criteria Tab page I can confirm that settings look as I would expect them to be.

Next...
* I USE the specific 'table' with the Default Buffering.
* I use the INSERT INTO <etc> command to insert a new record which appears OK if I confirm with a BROWSE on the View.
* I next issue a TABLEUPDATE()
* But when I do a REQUERY() to ensure the new record has actually been saved properly to the backend -- I get an error message.

No update tables are specified. Use the Tables property of the cursor.

What have I missed?
Unfortunately the error message is too generally worded to point me in the right direction.

Your advice or suggestions would be most appreciated.

Thanks,
JRB-Bldr
 
JRB-Bldr,

You need to set the Tables property to a comma-delimited list of the tables that you want to update. If there is only one table in your view, just set the property to the name of that table.

Also, make sure you have the SendUpdates property set to .T.

In fact, you can make it easier on yourself by setting all the properties in the view designer, and just toggling SendUpdates programmatically.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike - Thanks for the reply.
* Yes the Remote View only involves a single table.
* And, Yes I could have used a single comma, delimited string of field names, but I do it this way (or via an AFIELDS() array) to be as flexible as possible for use with other single-table Remote Views.

Actually I got things working and am only now getting back to the forum to mention it.

Although, as suspected, the error message had nothing to do with the solution.

"Also, make sure you have the SendUpdates property set to .T."
That's why I in the code above I used the line...
Code:
DBSETPROP(mcLeadView,'View','SendUpdates',.T.)

It turns out that while the code posted above was used to make one Remote View updatable, I had neglected to use the same code on Remote View #2.
I guess that it was just one more of those "Doh!!!" momemts!!!
Once I did that and eliminated all of the .NULL. values which the destination table didn't like, things worked fine.

Thanks,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top