I have an ASP page that uses an MS-Access database.
When I run it on my Web host's server the databases's
".LDB" file still exists after completion.
I gather this happens when a connection is left open.
I believe I am closing all my connections by using
"Set objXXX = Nothing".
Below is all of the code that works with the database.
Can anyone spot a problem? Thanks in advance.
Sub Process1()
Dim objADO
Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open cDSN & Server.MapPath("Database1.mdb")
Dim objRST
'*
Set objRST = Server.CreateObject("ADODB.Recordset")
objRST.Open "Table1", objADO, adOpenKeySet, adLockOptimistic,
adCmdTable
objRST.AddNew
objRST("Field1").Value = ""
objRST.Update
objRST.Close
Set objRST = Nothing
'*
objADO.Close
Set objADO = Nothing
End Sub
Sub Process2()
Dim objADO
Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open cDSN & Server.MapPath("Database1.mdb")
Dim objRST
Dim objRSU
Dim objRSX
'*
Set objRSX = objADO.Execute("DELETE FROM Table2")
Set objRSX = Nothing
'*
Set objRSX = Server.CreateObject("ADODB.Recordset")
objRSX.Open "Table2", objADO, adOpenKeySet, adLockOptimistic,
adCmdTable
objRSX.AddNew
objRSX("Field1").Value = objRST("Field1").Value
objRSX.Update
objRSX.Close
Set objRSX = Nothing
'*
Set objRST = objADO.Execute(strSQL)
Do While Not objRST.EOF
objRST.MoveNext
Set objRST = Nothing
'*
Set objRST = objADO.Execute(strSQL)
Do While Not objRST.EOF
Set objRSU = objADO.Execute(strSQL)
Set objRSU = Nothing
objRST.MoveNext
Set objRST = Nothing
'*
Set objRST = objADO.Execute(strSQL)
Do While Not objRST.EOF
objRST.MoveNext
Set objRST = Nothing
'*
Set objRST = objADO.Execute(strSQL)
Do While Not objRST.EOF
objRST.MoveNext
Set objRST = Nothing
'*
objADO.Close
Set objADO = Nothing
End Sub
A Google Groups search found that I posted
a similar question almost three years ago:
URL:http://groups.google.com/group/microsoft.public.inetserver.asp.db/browse
_thread/thread/1a32044a73633701/6f6459aaefc85576?q=MS-Access+LDB+group%3Amic
rosoft.public.inetserver.asp.*&rnum=1#6f6459aaefc85576
The single response there does not apply.
Bob Barrows [MVP] - 14 Dec 2005 18:20 GMT
> I have an ASP page that uses an MS-Access database.
>
> When I run it on my Web host's server the databases's
> ".LDB" file still exists after completion.
This is usually a permissions problem. All database users must have Modify
rights for the folder that contains the database. is your site using forms
or integrated authentication? Is Anonymous turned on?
> I gather this happens when a connection is left open.
That's one way for this to happen. Another is a failure to delete the file
due to lack of permissions.
> I believe I am closing all my connections by using
> "Set objXXX = Nothing".
Actually, a connection is closed via the Close method. But dereferencing the
object should cause the connection to close before it is destroyed.
Of course, with session pooling, connections will remain open for a set
period of time.
Bob Barrows

Signature
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Kyle Peterson - 14 Dec 2005 19:23 GMT
probably not code related
most likely permissions... the server can not properly create and delete the
lock file
http://www.powerasp.com/content/new/windows_2003_server_and_permissions.asp
also, the database folder needs permissions...not just the .mdb file and
that can also be an issue if the whole folder wasn't given permissions
>I have an ASP page that uses an MS-Access database.
>
[quoted text clipped - 83 lines]
>
> The single response there does not apply.
Bob Barrows [MVP] - 28 Jan 2006 12:44 GMT
> I have an ASP page that uses an MS-Access database.
>
> When I run it on my Web host's server the databases's
> ".LDB" file still exists after completion.
Is this resolved?

Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
McKirahan - 28 Jan 2006 15:38 GMT
> > I have an ASP page that uses an MS-Access database.
> >
> > When I run it on my Web host's server the databases's
> > ".LDB" file still exists after completion.
>
> Is this resolved?
Bob, thanks for the follow up.
I used my Web host's Admin Console to:
Change Permissions
OK: Set the permissions of browser to
READ/WRITE/EXECUTE/DELETE
on d:\0.0.0.0\folder successfully.
(Path changed to protect the innocent.)
Unfortunately, their console did not allow me to
see what the setting was before I changed it.
I think that did it. Thanks again!