Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / August 2007



Tip: Looking for answers? Try searching our database.

ASP Classic: Database problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
schurst30 - 20 Aug 2007 14:50 GMT
Hi, I am currently trying to get back into ASP and have begun looking at an
old webpage I developed some years ago, it was fully functional back in 2002
and I had it up and running with no problems. I have just recently bought a
new PC with Windows Vista Home Premium on it and installed IIS. When I try
and connect to my data base I get the following error message retunred:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Disk or network error.

/joynermorgan/take_registration.asp, line 50

Line 50 looks like this:

writeDB.Open "joynerm"

joynerm is the system DSN that I created to connect to my database.

The following is the actual code from the file take_registration.asp where
the error is occuring:

<%
  if p_password1 = p_password2 then

  set writeDB = Server.CreateObject ("ADODB.Connection")
  writeDB.Open "joynerm"

  sqlText = "select * from members where username = '"& p_username &"'"
  set userSet = DataBase.Execute (sqlText)

  if userSet.EOF then

  userSet.Close
  set userSet = Nothing

  theSQL = "insert into members"
  theSQL = theSQL & " (username, pass, first_name, last_name, email) "
  theSQL = theSQL & "values '"&p_username&"', '"&p_password1&"',
'"&p_firstname&"', '"&p_lastname&"', '"&p_email&"')"
 
end if

  DataBase.Execute (theSQL)

  DataBase.Close
  set DataBase = Nothing

  Response.Write "<h2 class='heading'>User Registration</font></h2>"
  Response.Write "<p>Thank you for your registration, if you wish you may
now <a href='/joynermorgan/index.asp'>go home</a>."

  else

  Response.Redirect "/joynermorgan/register.asp?retry=usernameunavail"

  end if

%>

I am fully aware that my coding techniques are out of date and therefore
will seem a little strange but as I said before, when I had this website up
and running some 5 years ago I never had a problem with this code at all.

Does anybody have any suggestions as to what could be the problem here?

Any help given would be much appreciated.

Many thanks in advance.

Spencer
Özer KAYHAN - 21 Aug 2007 08:02 GMT
Hi schurst30,
Try the code below. Replace VirtualDbPath with your mdb's virtual path.
And please be sure that IUSR_<MACHINE_NAME> user has read, write NTFS
permissions on your mdb file. Bye.

Dim writeDB, Rs
  if p_password1 = p_password2 then
      set writeDB = Server.CreateObject ("ADODB.Connection")
      Set Rs = Server.CreateObject("ADODB.Recordset")
      writeDB.Open "Provider=Microsoft.JET.OLEDB.4.0; Data Source='" &
Server.MapPath("VirtualDbPath") & "'"
           Rs.Open "select * from members where username = '"&
p_username &"'", writeDB, 3, 1
               if Rs.Recordcount>0 then
                   theSQL = "insert into members"
                   theSQL = theSQL & " (username, pass, first_name,
last_name, email) "
                   theSQL = theSQL & "values '"&p_username&"',
'"&p_password1&"',
                   '"&p_firstname&"', '"&p_lastname&"', '"&p_email&"')"
               End If
           Rs.Close
      writeDB.Close
      Set Rs = Nothing
      Set writeDB = Nothing
      Response.Write "<h2 class='heading'>User
registration</font></h2>"
      Response.Write "<p>Thank you for your registration, if you wish
you may now <a href='/joynermorgan/index.asp'>go home</a>."
  else
       Response.Redirect
"/joynermorgan/register.asp?retry=usernameunavail"
       Response.End
  end if
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.