[thelist] ASP error: Too few parameters.

Herrick, Emma eherric at ju.edu
Thu May 17 13:21:06 CDT 2001

OK, I knew I should've included code. Here's what I'm doing: a form is
submitted that is being parsed on the fly...i.e. I don't know what fields
I'm going to be getting so I look at the fields whose names are answer1,
answer2, etc. and then take them and match them to fields in the database,
then update the database. With me? Here goes...

set answers = server.createObject("Scripting.Dictionary")

' Each answer field would be named "answer1" "answer1a" and so forth.

for each key in request.form
	if lcase(left(key,6)) = "answer" then answers.add mid(key,7),

for each key in answers
	response.write key & ": " & answers(key) & "<br>"

'create connection, open it...
'create recordset

' Here you'll need to isolate (and retrieve) all the records for this user
for this section.
set rs = Server.CreateObject("ADODB.recordset")
sql = "select a.*, b.answer_type from question AS a, master_answer AS b
where a.report_id = " & request.querystring("ID") & " AND a.section_code =
'A' AND a.section_code = b.section_code AND a.question_no = b.question_no
AND a.version_no = b.version_no ORDER BY a.question_no;"

' Retrieve all their previous answers from the database for this section.
rs.open sql, db, adOpenForwardOnly, adLockOptimistic, adCmdText

' Loop through the stored answers.
while not rs.eof
	' Get the question number from this record
	qn = rs("question_no")
	qnt = rs("answer_type")

'this line I put in to trouble shoot. It returns one answer type and them
dies so it seems not to want to loop through the records after the first
	response.write qnt
	' If they've just submitted an answer to this question, then update
the record in the database
	' with the new answer. Then we remove it from the dictionary of
answers they've just submitted,
	' so that we know we've already handled it.
	if answers.exists(qn) then
		if qnt = "L" then
'if the answer type is 'long' it goes in one field, otherwise it goes in
another field
			rs("user_answer_long") = answers(qn)
			rs("user_answer_short") = answers(qn)
		end if
	end if

' Batch update all the records.

'end if

>-----Original Message-----
>From: Chris Johnston [mailto:chris at completeimaging.com]
>Sent: Thursday, May 17, 2001 2:02 PM
>To: thelist at lists.evolt.org
>Subject: RE: [thelist] ASP error: Too few parameters. 
>Can you send us the ASP code that you are trying to use. This 
>way we can see
>exactly what you are trying to do.
>-----Original Message-----
>From: thelist-admin at lists.evolt.org
>[mailto:thelist-admin at lists.evolt.org]On Behalf Of Herrick, Emma
>Sent: Thursday, May 17, 2001 1:53 PM
>To: thelist at lists.evolt.org
>Subject: [thelist] ASP error: Too few parameters.
>Does anyone know what this error means?
>Too few parameters. Expected 9.
>I get it on my sql statement which works fine if I run it in 
>access, but not
>through ASP. 9 is the number of fields I'm retrieving from 2 
>tables. Is it
>because I'm trying to do an update on one table with 2 tables 
>open? Am I not
>allowed to do that in ASP?
>I've looked the error up on MS but none of the examples seems 
>to apply to my
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list