Voor een gastenboek heb ik een stukje code geschreven wat inschrijvingen kanm verwijderen.
Door middel van een button onder de inschrijving.
De code werkt perfect op 1 ding na; na het uitvoeren van de code krijg ik een foutmelding op het scherm:
De code haalt dus wel de inschrijving eruit maar daarna wil ik die foutmelding eruit hebben.
Technische informatie (voor ondersteunend personeel)
Soort fout:
ADODB.Recordset (0x800A0E78)
De bewerking is niet toegestaan als het object gesloten is.
blablabla/delete.asp, line 33
Soort browser:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Pagina:
POST 0 bytes naar blabla/delete.asp
POST Data:
Tijd:
woensdag 4 augustus 2004, 20:51:59
Meer gegevens:
Microsoft Support
Dit is de code:
<!--#include file=adovbs.inc-->
<%
action = ""&Request ("action")
Response.Write action
Dim objConn, strQuery, objRs
' Set up a data connection for later queries
Set objConn = Server.CreateObject("ADODB.Connection")
' This is the path to the Access database
'objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=blabla\guestbook.mdb;Jet OLEDB:Database;"
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=blabla\guestbook.mdb;Jet OLEDB:Database;"
'Build the query depents on action
if action <> "" then
strQuery = "DELETE * FROM guestbook WHERE ID = "&action
'Execute the query
Set objRs = objConn.Execute(strQuery)
'Response.Redirect("delete.asp")
end if
if action = "" then
strQuery = "SELECT * FROM guestbook ORDER BY Post_Date DESC, Post_time DESC"
end if
'Execute the query
Set objRs = objConn.Execute(strQuery)
%>
<html>
<head>
<title>Opmerkingen verwijderen uit het gastenboek</title>
</head>
<body BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<!--No data return-->
<% If objRs.BOF And objRs.EOF Then %> !!!!!! DIT IS REGEL 33
<tr BGCOLOR="#FFFFFF">
<td ALIGN="center">
Het Gastenboek is leeg
<% Else %>
<!--Display the result-->
<% Do Until objRs.EOF %>
<form action="delete.asp?action=<%Response.Write objRS("ID")%>" method="post">
ID: <%Response.Write objRS("ID")%><br>
Datum: <% Response.Write objRs("Post_Date")%><br>
Tijd: <% Response.Write objRs("Post_Time")%><br>
Naam: <% Response.Write objRs("Name")%><br>
E-mail: <% Response.Write objRs("E_Mail_Address")%><br>
Woonplaats: <% Response.Write objRs("Org_Name")%><br>
Opmerking: <% Response.Write objRs("Comment")%><br>
<input TYPE="Submit" VALUE="verwijder">
</form>
<hr>
<% objRs.MoveNext %>
<% Loop %>
<% End If %>
<!--Close the data connection-->
<% objRs.Close %>
<% Set objRs = Nothing %>
<% objConn.Close %>
<% Set objConn = Nothing %>
</body>
</html>
Door middel van een button onder de inschrijving.
De code werkt perfect op 1 ding na; na het uitvoeren van de code krijg ik een foutmelding op het scherm:
De code haalt dus wel de inschrijving eruit maar daarna wil ik die foutmelding eruit hebben.
Technische informatie (voor ondersteunend personeel)
Soort fout:
ADODB.Recordset (0x800A0E78)
De bewerking is niet toegestaan als het object gesloten is.
blablabla/delete.asp, line 33
Soort browser:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Pagina:
POST 0 bytes naar blabla/delete.asp
POST Data:
Tijd:
woensdag 4 augustus 2004, 20:51:59
Meer gegevens:
Microsoft Support
Dit is de code:
<!--#include file=adovbs.inc-->
<%
action = ""&Request ("action")
Response.Write action
Dim objConn, strQuery, objRs
' Set up a data connection for later queries
Set objConn = Server.CreateObject("ADODB.Connection")
' This is the path to the Access database
'objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=blabla\guestbook.mdb;Jet OLEDB:Database;"
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=blabla\guestbook.mdb;Jet OLEDB:Database;"
'Build the query depents on action
if action <> "" then
strQuery = "DELETE * FROM guestbook WHERE ID = "&action
'Execute the query
Set objRs = objConn.Execute(strQuery)
'Response.Redirect("delete.asp")
end if
if action = "" then
strQuery = "SELECT * FROM guestbook ORDER BY Post_Date DESC, Post_time DESC"
end if
'Execute the query
Set objRs = objConn.Execute(strQuery)
%>
<html>
<head>
<title>Opmerkingen verwijderen uit het gastenboek</title>
</head>
<body BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<!--No data return-->
<% If objRs.BOF And objRs.EOF Then %> !!!!!! DIT IS REGEL 33
<tr BGCOLOR="#FFFFFF">
<td ALIGN="center">
Het Gastenboek is leeg
<% Else %>
<!--Display the result-->
<% Do Until objRs.EOF %>
<form action="delete.asp?action=<%Response.Write objRS("ID")%>" method="post">
ID: <%Response.Write objRS("ID")%><br>
Datum: <% Response.Write objRs("Post_Date")%><br>
Tijd: <% Response.Write objRs("Post_Time")%><br>
Naam: <% Response.Write objRs("Name")%><br>
E-mail: <% Response.Write objRs("E_Mail_Address")%><br>
Woonplaats: <% Response.Write objRs("Org_Name")%><br>
Opmerking: <% Response.Write objRs("Comment")%><br>
<input TYPE="Submit" VALUE="verwijder">
</form>
<hr>
<% objRs.MoveNext %>
<% Loop %>
<% End If %>
<!--Close the data connection-->
<% objRs.Close %>
<% Set objRs = Nothing %>
<% objConn.Close %>
<% Set objConn = Nothing %>
</body>
</html>