ASP Classic: Database problem

ASP Classic: Database problem

am 20.08.2007 15:50:04 von schurst30

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 "

User Registration

"
Response.Write "

Thank you for your registration, if you wish you may
now ."

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

Re: ASP Classic: Database problem

am 21.08.2007 09:02:44 von Support

Hi schurst30,
Try the code below. Replace VirtualDbPath with your mdb's virtual path.
And please be sure that IUSR_ 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 "

User
registration

"
Response.Write "

Thank you for your registration, if you wish
you may now ."
else
Response.Redirect
"/joynermorgan/register.asp?retry=usernameunavail"
Response.End
end if

*** Sent via Developersdex http://www.developersdex.com ***