lbowers
asked on
ODBC, DSNLess and a dBase database
I'm trying to open a DBF file via ODBC without using a DSN entry. Is this possible? Does anyone have any example code of how to achieve this? What should the connection string look like? I'm using DAO 3.51 and a dBase IV database. Thanks in advance...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Since dBase is not a model of a table containing tables, the folder becomes like a database and the files (tables) are specified in your queries.
ASKER
Excellent - Thanks for your help. The points are yours, but I was wondering if you had ever come across the following problem before:
I am able to READ records via the ODBC connection, but I get an error whenever I attempt to DELETE, ADD or UPDATE records. I have set all "Read Only" properties to false. Any ideas?
Thanks again.
I am able to READ records via the ODBC connection, but I get an error whenever I attempt to DELETE, ADD or UPDATE records. I have set all "Read Only" properties to false. Any ideas?
Thanks again.
Show me your code.
ASKER
Set ws = dao.CreateWorkspace("Works pace", "", "", dbUseODBC)
Set db = ws.OpenConnection("Disk5Co py", dbDriverNoPrompt, False, "ODBC;")
sSQL = "DELETE FROM house" ' For example
db.Execute sSQL
I get "ODBC--call failed" error!
Set db = ws.OpenConnection("Disk5Co
sSQL = "DELETE FROM house" ' For example
db.Execute sSQL
I get "ODBC--call failed" error!
You need to add you DSN name somewhere:
Set db = ws.OpenConnection("Disk5Co py", dbDriverNoPrompt, False, "ODBC;DSN=MYDSN")
Set db = ws.OpenConnection("Disk5Co
ASKER
Disk5Copy is my DSN. I find if I use "DSN=xxx" in the connections string, it doesn't work. Using the code I've show above, I can read records from the DBF file, I just can't ADD, DELETE or UPDATE! Hmmm...
Why don't you open the dBase file directly (without going through ODBC).
http://support.microsoft.com/support/kb/articles/Q240/7/48.ASP?LN=EN-US&SD=gn&FR=0
http://support.microsoft.com/support/kb/articles/Q240/7/48.ASP?LN=EN-US&SD=gn&FR=0
ASKER