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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Advice On How To Edit/Update FoxPro Tables From VB

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Most of my VB work has been using Access and Native Jet. I'm trying to edit and update FoxPro tables from a VB application. I created an ODBC connection that allows me to view the FoxPro table but I can't save my changes back to it. How do I do this? Any advice would be greatly appreciated.
The 2nd mouse gets the cheese.
 
I am having the same problem. I cannot update a Foxpro Table thru VB. I wish someone could help.
 
Did you make the recordset updatable and not just rely on the default (which is read only)? On the connection object, properties, advanced tab select Optimistic (or pessimistic).

Also make sure you are using the Visual FoxPro Driver even if for Fox 2.x tables.

I use VB6 with FoxPro tables all the time and no problem. Be wary of updating dates which in ADO SQL strings require special handling.
 
Has anyone solved this problem?? I'm trying to do the exact same thing- update Visual FoxPro tables via ADO in VB). When I try to invoke the update method of the ADO recordset object to commit changes I've made I get this message: Query cannot be updated because the FROM clause is not a single simple table name. If anyone has figured this one out I'd love to know. Thanks.

RyDye
 
Do you need a unique key with a foxpro table? You get this sort of problem with sql tables if you don't have one.
RyDye, what is your from clause? Peter Meachem
peter@accuflight.com
 
Right now I'm not using a sql statement to update the table...I was trying to add a record to the table using the addnew method. See code below. I get the error on the update method. Thanks!


With mCn

.ConnectionString = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDb=p:\fibermis\data\mis.dbc"
.CursorLocation = adUseServer
.Open

End With

mRs.Open strPath, mCn, adOpenDynamic, adLockOptimistic, adCmdTable

mRs.AddNew

mRs!Dbh = 6
mRs!Height = 85

mRs.Update 'Get error here!

booRecordAdded = True

'mRs.Close

mCn.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top