If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Guestbbook at brinkster problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-23-03, 02:08
Akumaownz Akumaownz is offline
Registered User
 
Join Date: Dec 2003
Posts: 10
Guestbbook at brinkster problem

Hey nice ppl

I have set up a guestbook at brinkster with this code
__________________________________________________ __
Guestbook.asp
<html>
<head>
<title>ASP Guestbook</title>
</head>
<body>

<font face="ARIAL" size="2" color="BLACK"><b>
Welcome to my guestbook...</b></font></p>
<FORM METHOD="POST" ACTION="guestbookThankYou.asp">
Name: <INPUT NAME="name" size="33"><br>
Email: <INPUT NAME="email" size="33"><br>
URL: <INPUT NAME="url" size="33"><br>
Message: <textarea rows="6" name="message" cols="30">
</textarea><br>
<INPUT TYPE="SUBMIT" VALUE="SEND">
<INPUT TYPE="BUTTON" VALUE="VIEW GUESTBOOK"
onClick="location.href='guests.asp';">
</form>
</body>
</html>
__________________________________________________ __
Guests.asp

<html>
<head>
</head>
<body>

<p>Guestlist entries....</p>
<%
openStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/db/dbguests.mdb")
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open openStr, UserID, Password
SQL = "SELECT * FROM guestbook ORDER BY 'ID' DESC"
Set record = Server.CreateObject("ADODB.Recordset")
record.Open sql, cn
record.MoveFirst
Do While Not record.EOF
Response.Write"<b>Date</b>: " & record("todaysDate").Value & "<br>"
Response.Write"<b>Name</b>: " & record("name").Value & "<br>"
emailValue=record("email").Value
Response.Write"<b>Email: </b>" & _
"<A HREF='mailto:" & emailValue & "'>" & emailValue & "</A><br>"
urlValue=record("url").Value
Response.Write"<b>URL: </b><A HREF='" & _
urlValue & "' target='blank'>" & urlValue & "</A><br>"
Response.Write"<b>Message</b>: " & _
record("message").Value & "<br>"
Response.Write"<hr width='80%'>"
record.MoveNext
Loop

record.Close
Set record = Nothing
cn.Close
Set cn = Nothing
%>

</body>
</html>
__________________________________________________ __
guestThankyou.asp

<html>
<head>
</head>
<body>

<p>Thank you for signing my guestbook...</p>
<FORM METHOD="POST" ACTION="guests.asp">
<%
Set cn = Server.CreateObject("ADODB.Connection")
openStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/db/dbguests.mdb")
cn.Open openStr
SQL = "SELECT * FROM guestbook"
Set record = Server.CreateObject("ADODB.Recordset")
record.Open sql, cn, 2, 2
record.AddNew
record("name") = Request.Form("name")
record("email") = Request.Form("email")
record("url") = Request.Form("url")
record("message") = Request.Form("message")
record("todaysDate") = Now()
record.Update
record.Close
Set record = Nothing
cn.Close
Set cn = Nothing

%>
<INPUT TYPE="BUTTON" VALUE="VIEW GUESTBOOK"
onClick="location.href='guests.asp';">
</form>
</body>
</html>

I have placed my db(dbguests.mdb) in the bd folder on brinkster and changed the server map path to Server.MapPath("/db/dbguests.mdb")

When I go to my guestbook and submit the data I enter I get this error:

Thank you for signing my guestbook...

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x898 Thread 0x2a0 DBC 0x101bb024 Jet'.

/ozhorseasp/guestbookThankYou.asp, line 11

Here is the url to my guestbook.
http://www27.brinkster.com/ozhorseasp/guestbook.asp

Any1 got any ideas where I am going wrong??

Or should I be using some other guestbook for brinkster??
Reply With Quote
  #2 (permalink)  
Old 12-23-03, 14:32
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
your MapPath() may return a wrong path for your database file

Since the MapPath() returns a virtual path to the corresponding physical directory on the server, your MapPath() will produce the following output c:\inetpub\wwwroot\db\dbguests.mdb. If your database file db\dbguests.mdb is not located under the c:\inetpub\wwwroot directory you will get the error message which is the same as the one you got.

You can try to use Server.MapPath("../") to return the relative physical path to the page that is being viewed in the Web browser.

Last edited by gyuan; 12-23-03 at 14:35.
Reply With Quote
  #3 (permalink)  
Old 12-23-03, 16:32
Akumaownz Akumaownz is offline
Registered User
 
Join Date: Dec 2003
Posts: 10
Thankx

gyuan

Thank you ill give that a go.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On