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

My code works fine when I use ADO c

Status
Not open for further replies.

codegirl

Technical User
Feb 9, 2003
13
US
My code works fine when I use ADO controls to search through the database. However, I get an error when I try to update the database. I haven't been using ADO controls for updating, adding, or deleting, rather I use this code:

Dim conResult As New ADODB.Connection
Dim cmdResult As New ADODB.Command

conResult.mode = adModeShareDenyNone
conResult.CursorLocation = adUseClient
conResult.Provider = "Microsoft.Jet.OLEDB.4.0"
conResult.ConnectionString = "DSN=myDSN"
conResult.Open

Set cmdResult.ActiveConnection = conResult
cmdResult.CommandType = adCmdText
cmdResult.CommandText = strUpdate 'SQL Command
cmdResult.Execute

I get an error on the line that says "conResult.Open". The error says "Cannot find installable ISAM." I've tried this on several computers so I don't think it's something I missed installing Visual Studio. Also, when I replace the ConnectionString property with a connection string (the kind you build in the wizard when you select "Use Connection String") instead of a DSN, it works fine.

How can I update, add, and delete records using ODBC?? I want to use ODBC so I can connect over a network without the database path hardcoded into my code!

Oh yeah, and I'm using MS Access.

Thanks in advance for any help!!
 
what version of Access is your database? I've seen this problem with Access97 databases, especially if your ODBC connection is using jet 3.51
 
I think I fixed the problem, so here's how I did it for anyone who with the same problem who stumbles across this thread... I simply removed the line that says:

conResult.Provider = "Microsoft.Jet.OLEDB.4.0"

I imagine that's because ODBC takes care of what type of database it is. When I specified the provider, the ADODC was probably looking for an Access database, but when it found an DSN instead it didn't know what to do. At least that's my guess :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top