baby
Dec 16th, 2003, 02:14 AM
hi guys
Recently i have been given a task to debug a website survey system. The problem is whenever user tried to submit there i will be a error saying No value give for one or more required parameter I am very very new to asp and in fact this is the first time i come in contact with asp. Was doing jsp previously this is for one of my final year project. Would apperciate if anyone could help :)
This is the code....
<%Option Explicit%>
<!--#include file="includes/config.asp" -->
<%
dim conn, rs, strsql, x
dim updateOK
dim update_survey_status
dim i
dim array_result()
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("mentorDB.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
strsql = "SELECT * FROM " & survey_result_table
for i = 0 to 12
redim preserve array_result(i)
array_result(i) = "Q" & i+1
next
rs.open strsql, conn, 1
strsql = "UPDATE [" & survey_result_table & "] SET "
for i = lbound(array_result) to ubound(array_result)
if i <> ubound(array_result) then
strsql = strsql & array_result(i) & "='" & request.form(array_result(i)) & "',"
elseif i = ubound(array_result) then
strsql = strsql & array_result(i) & "='" & request.form(array_result(i)) & "'"
end if
next
strsql = strsql & " WHERE ADM='" & Session("ParseAdm_No") & "'"
on error resume next
conn.execute strsql
if err<>0 then 'if have errors
updateOK = false
response.write("<script language = 'javascript'> alert('" & err.Description & "'); </script>")
else 'If no errors
updateOK = true
end if
if updateOK = true then
strsql = "UPDATE [" & left(trim(Session("ParsePem_Gpr")),2) & "] SET SURVEY_DONE=TRUE WHERE ADM='" & Session("ParseAdm_No") & "'"
on error resume next
conn.execute strsql
if err<>0 then 'if have errors
update_survey_status = false
else 'If no errors
update_survey_status = true
end if
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
if updateOK = true and update_survey_status = true then
response.redirect("http://localhost/night/thanks.asp")
elseif updateOK = false or update_survey_status = false then
response.write("Update failed. Please contact administrator.")
end if
%>
Recently i have been given a task to debug a website survey system. The problem is whenever user tried to submit there i will be a error saying No value give for one or more required parameter I am very very new to asp and in fact this is the first time i come in contact with asp. Was doing jsp previously this is for one of my final year project. Would apperciate if anyone could help :)
This is the code....
<%Option Explicit%>
<!--#include file="includes/config.asp" -->
<%
dim conn, rs, strsql, x
dim updateOK
dim update_survey_status
dim i
dim array_result()
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("mentorDB.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
strsql = "SELECT * FROM " & survey_result_table
for i = 0 to 12
redim preserve array_result(i)
array_result(i) = "Q" & i+1
next
rs.open strsql, conn, 1
strsql = "UPDATE [" & survey_result_table & "] SET "
for i = lbound(array_result) to ubound(array_result)
if i <> ubound(array_result) then
strsql = strsql & array_result(i) & "='" & request.form(array_result(i)) & "',"
elseif i = ubound(array_result) then
strsql = strsql & array_result(i) & "='" & request.form(array_result(i)) & "'"
end if
next
strsql = strsql & " WHERE ADM='" & Session("ParseAdm_No") & "'"
on error resume next
conn.execute strsql
if err<>0 then 'if have errors
updateOK = false
response.write("<script language = 'javascript'> alert('" & err.Description & "'); </script>")
else 'If no errors
updateOK = true
end if
if updateOK = true then
strsql = "UPDATE [" & left(trim(Session("ParsePem_Gpr")),2) & "] SET SURVEY_DONE=TRUE WHERE ADM='" & Session("ParseAdm_No") & "'"
on error resume next
conn.execute strsql
if err<>0 then 'if have errors
update_survey_status = false
else 'If no errors
update_survey_status = true
end if
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
if updateOK = true and update_survey_status = true then
response.redirect("http://localhost/night/thanks.asp")
elseif updateOK = false or update_survey_status = false then
response.write("Update failed. Please contact administrator.")
end if
%>