Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP connection to DB - need help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP connection to DB - need help

 Post Reply Post Reply
Author
AlvinLim View Drop Down
Newbie
Newbie


Joined: 11 March 2003
Location: Malaysia
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote AlvinLim Quote  Post ReplyReply Direct Link To This Post Topic: ASP connection to DB - need help
    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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.