PDA

View Full Version : Please help. Why the database become locked after I enter the website?


alingradinaru
06-19-2003, 04:04 AM
Hi!

I have a problem. I build my first website in ASP and I have a problem: after I open any of the pages in browser, the database become locked. In the folder where the database is, appears a clone of the database with the extension .ldb.

I tried to change the connection type from ODBC to OLDB and nothing.

I have restarted the computer, I deleted the ldb file, and when I entered the site again, it was there.

I tried to close the connection and the recordsets at the bottom of the pages.

The site loads only once and the ldb doesn't appear anymore, but when I refresh the page or I try to navigate (visit another page), the entire website gets down. I get errors on every page.

Please help me. I just don't know what to do.

The website is: http://shopgsm.intersoftdev.ro

Unfortunately, it is written in romanian, my native language.

Thank you in advance for your time.

Best regards, A.G.!

Frank
06-19-2003, 08:54 AM
The .ldb file is normal. That will appear anytime you open an Access database. If the file is there then chances are the database is already open. In your ASP code, you have to make sure you close the database after you add or retrieve the information to/from the database before trying to open it again.

Here is a short example of how I add records to an MS Access database. The code in BOLD is what closes the database:

MainDriver = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=g:/Inetpub/db/accounts.mdb"

set Connection = Server.CreateObject("ADODB.Connection")
set RecordSet = Server.CreateObject("ADODB.RecordSet")

Connection.Open MainDriver

RecordSet.Open "users", Connection, 2, 2
RecordSet.AddNew

RecordSet("Username") = Username
RecordSet("Password") = Password
RecordSet("Email") = Email

RecordSet.Update

RecordSet.Close
Set RecordSet = nothing
Connection.Close
Set Connection = Nothing

(Remeber this is just an example of code. THere are lots of ways to do this. WHat you want to concentrate on are the lines in bold)

If you don't close the database connection before trying to open it again, you'll often get an error.

HTH
Frank