Information générale
Catégorie:
Visual FoxPro et .NET
Titre:
Foxpro OLE DB Driver - Does it support updating???
Does anyone know if the foxpro OLE DB driver supports updating Foxpro databases?
The following code uses ADO to connect and attempt to edit a simple foxpro table.
If I use the ODBC connection string, it works. If I use the OLE DB connection string if causes an error something like
"object or provider is not capable of performing the required operation"
I have also being playing with visual studio .net, and get a similar problem. I can connect and retrieve data happily using the oledbdataadapter object, but updating, inserting or deleting foxpro tables fails every time.
the code listing (please change the file paths and table names if you want to try it)
&&&here is the ole db connection string
constr='Provider=VFPOLEDB.1;Data Source=C:\FXCLIENT\CSDATA\CSDATA.DBC;Mode=Share Deny None;Extended Properties="";User ID="";Password="";Mask Password=False;Cache Authentication=False;Encrypt Password=False;Collating Sequence=MACHINE'
&&&here is the odbc connection string
constr='DSN=testpms;UID=;PWD=;SourceDB=C:\fxclient\CSdata\csdata.dbc;SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;'
&&here is the odbc connection string
con=Createobject("adodb.connection")
con.connectionstring=constr
con.Open
Sqlstr="select client,surname from clients where client='A0001'"
rs=Createobject("adodb.recordset")
rs.cursortype=2
rs.locktype=3
rs.Open(Sqlstr,con)
If Not rs.Eof
Messagebox("record found")
rs.Fields("surname").Value="test update"
rs.Update
Else
Messagebox("record not found")
Endif
rs.close
con.Close
RELEASE rs
RELEASE con
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement