By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Please help: Cant get rid of lock on the MS access DB

P: n/a
Joe
Hi,
I have an asp.net page that opens up a connection to MS access DB and does insert into DB. I am using close() and setting the connection object to Nothing after I am done with inserting a record. After inserting when I look at the server where the MS access DB resides I also see a *.ldb file also. For some reason I cannot get rid of this *.ldb file even after I close the connection to DB from my asp.net page. As long as this *.ldb file is there I cannot overwrite /rename/move this MS Access DB. The only way I can get rid of this *.ldb file is by restarting the IIS which is not a good solution.
Can anyone give me an idea if I am doing something wrong or how to get rid of this *.ldb file?
Thanks,
Joe
___
Newsgroups brought to you courtesy of www.dotnetjohn.com
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Joe,

I have a little program the writes to an access.mdb file from an ASP.NET
page. If it is creating the .ldb file (the lock file), it is happening so
fast I don't even see it.

Here is my code that works. I am not even calling dispose on my connection
object.

Try
cn.Open()
cmd.ExecuteNonQuery()

Catch ex As Exception
ErrorAlert("An error occured saving to database. Please try
again.")
Trace.Warn(ex.ToString)
Return
Finally
cn.Close()
End Try

Are you successfully inserting the record at all? If not, maybe ASPNET user
doesn't have modify rights to the folder the .mdb resides in.

I just tried renaming the .mdb immediately after running my program, and it
let me do it. (no lock by IIS or anything)

Bottom line: while Access on a web server is not a good idea (everybody can
stop typing now!), it should not be behaving the way it is for you...

HTH,
Greg

"Joe" <Jo*@joe.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,
I have an asp.net page that opens up a connection to MS access DB and does insert into DB. I am using close() and setting the connection object to
Nothing after I am done with inserting a record. After inserting when I look
at the server where the MS access DB resides I also see a *.ldb file also.
For some reason I cannot get rid of this *.ldb file even after I close the
connection to DB from my asp.net page. As long as this *.ldb file is there
I cannot overwrite /rename/move this MS Access DB. The only way I can get
rid of this *.ldb file is by restarting the IIS which is not a good
solution. Can anyone give me an idea if I am doing something wrong or how to get rid of this *.ldb file? Thanks,
Joe
___
Newsgroups brought to you courtesy of www.dotnetjohn.com

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.