Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Newbie Question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Newbie Question

 Post Reply Post Reply
Author
wonkymatt View Drop Down
Newbie
Newbie
Avatar

Joined: 22 November 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote wonkymatt Quote  Post ReplyReply Direct Link To This Post Topic: Newbie Question
    Posted: 22 November 2007 at 12:02pm

Hi All,

I am just starting to play with ASP.  I have been following the Connecting an Access database to ASP tutotial on the WebWiz site.

Its all gone well so far, the guest book works and I can add records via the form but I cant seem to get the delete_select.asp delete_entry.asp bit to work.  I keep getting the Error 500 page.

Now am I missing something obvious - I have copied and pasted the code for the delete_select.asp straight off the page.

I have kept the file names the same and am useing the DSN-Less connection.  Running on Windows Server 2003 Standard with SP2 and IIS.

 
Heres the code for delete_select.asp
 
 <html>
<head>
<title>Delete Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon          'Holds the Database Connection Object
Dim rsGuestbook     'Holds the recordset for the records in the database
Dim strSQL          'Holds the SQL query for the database
           'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
'Loop through the recordset
Do While not rsGuestbook.EOF
     'Write the HTML to display the current record in the recordset
     Response.Write ("<br>")
     Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
     Response.Write (rsGuestbook("Name"))
     Response.Write ("</a>")
     Response.Write ("<br>")
     Response.Write (rsGuestbook("Comments"))
     Response.Write ("<br>")
     'Move to the next record in the recordset
     rsGuestbook.MoveNext
Loop
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html> 
 
and heres delete_entry.asp
 
<%
'Dimension variables
Dim adoCon          'Holds the Database Connection Object
Dim rsDeleteEntry   'Holds the recordset for the record to be deleted
Dim strSQL          'Holds the SQL query to query the database
Dim lngRecordNo     'Holds the record number to be deleted 
 
'Read in the record number to be deleted
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("guestbook.mdb")
 'Create an ADO recordset object
Set rsDeleteEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments WHERE ID_no=" & lngRecordNo
'Set the lock type so that the record is locked by ADO when it is deleted
rsDeleteEntry.LockType = 3
'Open the recordset with the SQL query
rsDeleteEntry.Open strSQL, adoCon
'Delete the record from the database
rsDeleteEntry.Delete
'Reset server objects
rsDeleteEntry.Close
Set rsDeleteEntry = Nothing
Set adoCon = Nothing
'Return to the delete select page in case another record needs deleting
Response.Redirect "delete_select.asp"
%>

 
The rest of the files in the folder are
  • guestbook.mdb
  • guestbook_form.htm
  • add_to_guestbook.asp
  • guestbook.asp

Any help here would be great - cant see the problem, but then I don't really know what I'm looking for.

Thanks in advance
 
Matt
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 22 November 2007 at 1:26pm
If you turn off friendly HTTP errors messages in IE you will get what the actual error is.
Back to Top
shakir View Drop Down
Groupie
Groupie


Joined: 08 November 2007
Location: Saudi Arabia
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote shakir Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2007 at 1:35pm
check the query strSQL = "SELECT tblComments.* FROM tblComments;"

try
strSQL = "SELECT* FROM tblComments"
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.