Print Page | Close Window

ASP connection to DB - need help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=939
Printed Date: 29 March 2026 at 1:24pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP connection to DB - need help
Posted By: AlvinLim
Subject: ASP connection to DB - need help
Date Posted: 12 March 2003 at 12:13am

Greetings,

I am a new user here and I am hoping some of you can help me with the ASP problem I am having now (I just started learning ASP few days ago). The error is:

Error Type:
Microsoft JET Database Engine (0x80004005)
Could not use ''; file already in use.

I do understand that I need to close down this DB file in order to solve this error. But as admin, is there any other way besides restarting and logging off from Win XP?

here is part of my code.

dim dbloc 'String to copy database location
 dim dcndb 'as ADODB.connection
 dim recorddb 'as ADODB.Recordset
 dim strsql 'as string
 dim status
 
 status = 0
 Session("ErrorMessage") = ""
 
 dbloc = "C:\Inetpub\wwwroot\db\db1.mdb"
 set dcndb = Server.Createobject("ADODB.Connection")
 dcndb.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;Data Source=" _
  & dbloc

  set recorddb = Server.Createobject("ADODB.Recordset")
 Call dcndb.open(dbloc)

 

the last line is line 28. Below is how i close my DB but it seems to have failed.

if status = 1 then
  dim string
  string = "The sign in name is already exist in the database. Please choose another <br\>"
  Session("ErrorMessage") = string
  recorddb.close
  dcndb.close
  Server.transfer("verify.asp")
 else
  strsql = "INSERT into member values ( '"& sign_in &"','"& fname &"','"& lname &"','"& email &"','"& address &"', '"& zipcode &"', '"&city&"', '"&state&"', '"&country&"', '"&gender&"', '"&dob&"', '"&occupation&"', '"&password&"', '"&question&"', '"&answer&"')"
  dcndb.execute(strsql)
  recorddb.close
  dcndb.close
 end if

 recorddb.close
 dcndb.close

 

sorry coz my program is a bit messy as I am really new in ASP. Sorry for the trouble. Please ask if you need more information regarding my error.

Another thing is - this form is for registration. If there's a new user with an already exist sign in name (in the database), I should provide an error message saying "Choose another sign in name" or something but the Session("ErrorMessage") = the string does not appear, and the error that occurs is something on "Execute" <---i will post more info on this 2nd part soon

 

again, thanks in advance.



-------------
Regards,
Alvin Lim of Malaysia
~Life is short, cherish everything you have before it's too late~



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net