というわけで、記事編集機能をサイトにつけようと思っていてつまずきました。エラーは次のとおりです。
Microsoft JET データベース エンジン エラー '80040e10'
1 つ以上の必須パラメーターに値が指定されていません。
/courses/benv/2410/2013s2/3420384/assign4/edit.asp、130行目
以下のコードのステージ 3 でエラーが発生しています。具体的には、Suburbtable update コマンドの直後。
試してデバッグするためにprintステートメントを追加したところ、次のようになりました。
update SuburbTable set suburb='Kensington', postcode=2033 where projectsTable.ID= 56
以下のコード。助けていただければ幸いです。
<% option explicit %>
<html>
<head>
<link href="normalize.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type-"text/css" href="960_12_col.css">
<link rel="stylesheet" type-"text/css" href="style.css">
</head>
<body>
<!--#include file="dbconn.asp"-->
<!--#include file="header.asp"-->
<div class="content">
<div class="content-inner container_12">
<div class="wrapper prefix_2 grid_8 suffix_2">
<%
if Session("username")="" then
Response.Redirect("Login.asp")
end if
dim stage, SQL, info
stage = request.form("stage")
if stage = "" then stage=1
'------------------------------------------------------------------
if stage = 1 then
'------------------------------------------------------------------
response.write "<form action=""edit.asp"" method=""post"">" &_
"<input type=""hidden"" name=""stage"" value=""2"">"
'--- create a radio-button list of the posts
' 0 1
SQL="select ProjectsTable.ID, ProjectName from ProjectsTable order by Created"
set info=conn.execute(SQL)
'-- Loop through the recordset to make each entry in the list.
do while not info.eof
response.write "<label id=""Select""for=""radio""></label>"&_
"<input id=""radio""type=""radio"" name=""change"" "&_
"value="""&info(0)&""">"&info(1)&"<br>"&chr(13)
info.movenext
loop
response.write "<input class=""button"" type=""submit"" value=""Select!"">" &_
"</form>"
'------------------------------------------------------------------
elseif stage = 2 then
'------------------------------------------------------------------
dim record_num
record_num=Request.Form("change")
if record_num="" then response.redirect "?pg=change"
' 0 1 2 3 4 5
SQL="SELECT ProjectsTable.ID, ProjectName, Description, suburb, postcode, pictureURL"&_
" FROM ProjectsTable, SuburbTable, CategoryTable"&_
" WHERE ProjectsTable.ID= "&record_num &_
" AND suburbtable.id = SuburbNum AND categorytable.ID = categoryNum"
set info=conn.execute(SQL)
%>
<form action="edit.asp" method="post">
<input type="hidden" name="stage" value="3">
<input type="hidden" name="ProjectsTable.ID" value="<% =record_num %>">
<label for="title">Title</label>
<input id="title" type="text" name="title" value="<% =info(1) %>"><br>
<label for="image">Image URL</label>
<input id="image" type="text" name="image" value="<% = info(5) %>"><br>
<label for="post">Post</label>
<textarea id="post" name="post"><%=info(2) %></textarea><br>
<label for="suburb">Suburb</label>
<input id="suburb" type="text" name="suburb" value="<% =info(3) %>"><br>
<label for="postcode">Postcode</label>
<input id="postcode" type="text" name="postcode" value="<% =info(4) %>"><br>
<%
' 0 1
sql = "select categorytable.ID, category "&_
"from categorytable "&_
"order by category "
set info=conn.execute(SQL)
%>
<label for="category">Category</label>
<select name="category">
<%
do until info.eof
response.write "<option value=""" & info(0) & """>" & info(1) & "</option>"
info.movenext
loop
%>
</select> <br>
<input id="edit" class="button" type="submit" value="Edit">
</form>
<%
'------------------------------------------------------------------
elseif stage = 3 then
'------------------------------------------------------------------
dim title, post, post_id, picture, suburb, postcode, category, u, uid, s_info
title=Request.Form("title")
post=Request.Form("post")
u=Session("username")
post_id=Request.Form("ProjectsTable.ID")
picture=Request.Form("image")
suburb=Request.Form("suburb")
postcode=Request.Form("postcode")
category=Request.Form("category")
' 0
sql = "select usertable.id "&_
"from usertable where username='"&u&"'"
set info=conn.execute(sql)
uid = info(0)
sql="update SuburbTable set suburb='"& suburb & "', postcode=" & postcode & " "&_
"where projectsTable.ID= "&post_id
response.write(SQL)
conn.execute sql
' 0
sql = "select id from suburbtable where suburb='" & suburb & "' and postcode=" & postcode & " "
set s_info=conn.execute(sql)
sql="update projectsTable set projectName='"& title & "', Description='" & post & "', "&_
"usernum="& uid & ", categorynum="& category & ", pictureURL='"& picture & "', suburbNum="& s_info(0) & " "&_
"where projectsTable.ID= "&post_id
conn.execute sql
response.write "<p>Post edited.</p>"
'------------------------------------------------------------------
end if ' stage
'------------------------------------------------------------------
if stage=3 then
response.write "<a href=""default.asp"">Show Posts</a>"
end if
conn.close
%>
</div>
</div>
</div>
<!--#include file="footer.asp"-->
</body>
</html>