Forum Moderators: open
Here is the old code...
<%
Dim objConn
Dim adUseClient
adUseClient = 3
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open Session("totaltecconnect")
objConn.CursorLocation = adUseClient
%>
Here is the error...
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/admin/inc/TT_ConnectCursorLoc.asp, line 6
TIA for any suggestions!
MyConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\PathTo\MyDatabase.mdb;User Id=admin;Password=;"
Using this...
<%
Dim objConn
Dim adUseClient
adUseClient = 3
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\\HOSTING\DFS\20\1\1\9\2053580911\user\sites\totaltec.com\www\totaltec.mdb"
objConn.CursorLocation = adUseClient
%>
I get this error...
ADODB.Recordset error '800a0e7d'
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/index.asp, line 71
Line 71 is...
objrs.open strsql, objconn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\\HOSTING\DFS\20\1\1\9\2053580911\user\sites\example.com\www\example.mdb" It's recommended to use an OLEDB connection string instead of ODBC with Access (or even better, use SQL Server):
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\HOSTING\DFS\20\1\1\9\2053580911\user\sites\example.com\www\example.mdb" BTW: you can use Server.MapPath("/example.mdb") to easily map a virtual path to a file path.
Try doing a nice simple ASP page to open and query the database on your PC, if you have IIS installed locally. When it's working, transfer it to your server and then try new connection string. Check with your host if you're still having problems, I imagine they will have done this before... Let us know the solution when resolved.