Jeg har brug for hjælp...
Jeg har dette admin-modul til min gæstebog, men jeg fatter ikke at jeg ikke kan få den til at opdatere post\'en. Uanset hvad, slettet den den pågældende post... her er koden, plz en eller anden hjælp mig :o)<% mode = request(\"mode\") %>
<% Response.buffer = true %>
<% if mode = \"\" then %>
<body bgcolor=\"#ffffff\">
<%
\'Connection til databasen
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath (\"guestbook.mdb\")
strSQL = \"select* from guestbook ORDER BY ID DESC\"
set rs = Conn.execute(strSQL)
if rs.EOF then
Response.write \"<font face=\"\"Verdana\"\" size=\"\"2\"\">Der er ingen indlæg i databasen!</font>\"
else
Do Until rs.EOF
%>
<form method=\"POST\" action=\"admin.asp?mode=update\">
<input type=\"hidden\" name=\"id\" size=\"20\" value=\"<%=RS(\"id\")%>\">
<div align=\"center\">
<center>
<table border=\"1\" width=\"170\" height=\"1\" bordercolor=\"#<%=Tablecolor%>\">
<tr>
<td width=\"83\" height=\"11\"><input type=\"text\" name=\"date\" size=\"20\" value=\"<%=RS(\"dato\")%>\"></td>
<td width=\"91\" height=\"11\"><input type=\"text\" name=\"navn\" size=\"20\" value=\"<%=RS(\"navn\")%>\"></td>
</tr>
<tr>
<td width=\"170\" height=\"13\" colspan=\"2\"><textarea rows=\"3\" name=\"besked\" cols=\"37\"><%=RS(\"kommentar\")%></textarea></td>
</tr>
<tr>
<td width=\"148\" height=\"16\"><input type=\"text\" name=\"email\" size=\"20\" value=\"<%=RS(\"email\")%>\"></td>
</tr>
<tr>
<td width=\"148\" height=\"1\">Slet besked<input type=\"checkbox\" name=\"delete\" value=\"ON\"></td>
<td width=\"148\" height=\"1\"><input type=\"submit\" value=\"opdater/slet\" name=\"send\"></td>
</tr>
</table>
</center>
</div>
</form>
<%RS.MoveNext
Loop
end if
Conn.Close
Set Conn = Nothing%>
<% end if %>
<% if mode = \"update\" then %>
<%
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\" & Server.MapPath(\"guestbook.mdb\") & \";UID=admin;PWD=;\"
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"Select * FROM guestbook WHERE id=\" & request.form(\"id\")
rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
%>
<% if Request.form(\"delete\") = \"ON\" then
Rs.delete
Response.Redirect \"admin.asp\"
%>
<% end if %>
<%
rs.Update
rs(\"Dato\") = Request.form(\"Dato\")
rs(\"Navn\") = Request.form(\"navn\")
rs(\"Email\") = Request.form(\"email\")
rs(\"kommentar\") = Request.form(\"Kommentar\")
rs.Update
rs.Close
Set rs = Nothing
Conn.Close
set Conn = Nothing
Response.Redirect \"admin.asp\"
%>
<% end if %>