ASP - ADO - Access - Error on connect

  • Thread starter Thread starter Christopher Knapp
  • Start date Start date
C

Christopher Knapp

Hello,

I have an Access database that is setup as a System Datasource on a Win2k Server. This Access database is accessed by about 15 workstations using another program already and has a file lock (.lck). I am trying to access the Access database via ASP on the IIS server at the same time but am getting an ADO error that it can not make the connection. Is this because the other program has a file lock?

If I copy the access file to another directory I can get the server to connect to it beautifully, but I need to pull live data over to the web server. Any input would be greatly appreciated. Thanks.
 
This may help...it is the error I am getting-



==========================================================
Title- Database Connection Error

Text- The server encountered an error while procession a database request. For more information, click Details.

Details- Server error: Unable to retrieve the list of record sources from a database using the connection string: DSN=shpdb;DRIVER={Microsoft Access Driver (*.mdb)}.
The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured.
 
According to
http://msdn.microsoft.com/library/en-us/ado270/htm/mdcsterrorvalueenum.asp
that error (-2146824584) corresponds to ADO error adErrObjectClosed
("Operation is not allowed when the object is closed.")

It would probably help more to show the code that's causing that error to
occur.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


This may help...it is the error I am getting-



==========================================================
Title- Database Connection Error

Text- The server encountered an error while procession a database request.
For more information, click Details.

Details- Server error: Unable to retrieve the list of record sources from
a database using the connection string: DSN=shpdb;DRIVER={Microsoft Access
Driver (*.mdb)}.
The following error message comes from the database driver software; it may
appear in a different language depending on how the driver is configured.
 
In addition to the error Doug has pointed out, it is important that the mdb
that resides on the webserver is only the tables and not a full blown Access
database. Users should have a frontend that connects to the backend tables.
The frontend contains the linked tables, queries, forms, reports, macros,
and any module code. See Splitting a database, if this is not the case in
your operation.

Also you must make sure that you close each recordset and/or database
connection when finished.
<%
'open the connection; Note: This is a DSN-less connection and better than
using a DSN
Dim conn
Dim vcs

Set conn = Server.CreateObject("ADODB.Connection")
vcs= "Provider=Microsoft.Jet.OLEDB.4.0"
vcs= vcs & "; Data Source=" & Server.MapPath
("\Database\ExpressDataWeb.mdb")
conn.connectionstring = vcs
conn.open
%>
<%
Dim objrs
Dim sqltext


'Create the recordset object
Set objrs = Server.CreateObject("ADODB.Recordset")

'Open the recordset getting a list of all accounts
sqltext = "Select * from qryTrackNumber"
sqltext = sqltext & " WHERE Account = '" & varAccount & "'"
sqltext = sqltext & " ORDER BY TrackNumber DESC"

objrs.Open sqltext, conn
%>
<%

'loop through the recordset set to populate the dropdown box.

objrs.MoveNext

Loop


'Close and dereference database objects
objRS.Close
Set objRS = Nothing

%>
<%
'Open a new recordset connection to return the data from the user's choice
in the drop down box.
'Although I explicitly closed the above recordset, I generally give a new
recordset a new name to avoid
' confusion with previous operation.

Dim objrs1
Dim strSQL


'Create the recordset object
Set objrs1 = Server.CreateObject("ADODB.Recordset")

'Set the SQL String

strSQL = "Select * from qryTrackNumber Where TrackNumber = " &
Request.Form("cboAutoTicket")


'Open the recordset getting all the data for this ticket
objrs1.Open strSQL, conn

%>

<%
' Close and dereference the database objects
objrs1.close
Set objrs1 = nothing

'Close the database connection
conn.close
Set conn = nothing

%>
 
Back
Top