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!

Pervasive 2

Status
Not open for further replies.

polymathinc

Programmer
Mar 19, 2007
10
US
I am working with a program called CYMA which uses a Pervasive database. With the Pervasive ODBC Engine I can create remote views and access the data without problem. It doesn't seem to allow me to update data. Ideally, I could append a record in a table and make changes. Does anyone have some sample code?
I have created a DBC, created REMOTE Views, USEd the Views, can browse the data, use the date in reports, but cannot update the date. It will update the view but as soon as I close the view the updates are no longer available. Anyone have experience with Pervasive? please advise. Thanks in advance.
 
I know nothing about Pervasive, but I have to ask the obvious question about using Remote Views with any non-VFP database (or for that matter even VFP databases).....

Have you set your Remote Views to be update-able?

This is either done interactively via the Remote View designer (MODIFY VIEW MyView) or by means of code commands such as CURSORSETPROP()

Then, depending on the Buffering that you are using, you either can update by Row or by Table.

Good Luck,
JRB-Bldr
 
Polymathinc,

JRB-Bldr is almost certainly right. You need to make the view updateable.

In the view designer, go to the Update Criteria tab. In the column under the little key icon, tick the field or fields that form the record's unique (primary) key. In the column under the pencil icon, tick the fields that you want to allow to be updated (probably all of them). Finally, tick the "Allow SQL updates" checkbox.

You can then update the remove view in the usual ways (for example, by issuing UPDATE or REPLACE commands, or by binding it to an editable form). To send the updates to the server, issue TABLEUPDATE().

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks - you guys are great. That was exactly the problem. Now, when I change something like the item description in the file I get a "update conflict" message. Any idea what that is about? I suspect I don't have a primary key or something in the original file.

Or I haven't selected the primary key properly from the pervasive data!?

Or I haven't done the "buffering" properly to allow the edits that I want to make.

Can you help me get over the hump? Thanks in advance.

Dave G.
 
Dave,

I'm not familiar with Pervasive's error message, but "update conflict" probably means that it can't find the record that you are trying to update. Usually, this is because another user has deleted or changed it.

In order to issue an update via a remote view, you definitely need a primary key (or some other unique key) in the table that you are updating. This must match the key field(s) that you specify in the view (under the key icon).

If the problem persists, try setting the "update where" section of the update criteria page to "key fields only". However, this means that you will no longer be checking for other users updating the same record, so you risk your update overwriting someone else's.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
When you say "item description", what's the actual name of the field? I've run into some databases that used DESC as the name of a description field. Since DESC is a reserved SQL word, using that name without delimiters causes an error. In that case, adding quotes around it resolves the problem.

Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top