Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request syntax problem 1

Status
Not open for further replies.

JonathanG6SWJ

Programmer
Joined
Jan 18, 2005
Messages
39
Location
GB
I have a for next loop that writes a sql update to db.
I am having problems with the syntax of incrementing a request statement variable.

RadioCount=1
For xx = intFirstRec to intLastRec
strSQL=strSQL + "' ,intBScore ='" & Request("QB1")
..the above line works fine but I want to increment the variable name ..QA1 / QA2 ..QA8

strSQL="UPDATE tblResultsData SET intAScore = '" & Request('"QA"& RadioCount')

..the line above does not work!!!

What shoud the syntax be??

strSQL=strSQL + "' WHERE intCompetency_obj_no = " & xx &";"
RadioCount=RadioCount+1
jConn.Execute (strSQL)
Next
jConn.Close
set jConn = Nothing

Many thanks in advance
Jonathan
 
The idea is solid but there are some problems with the implementation.

Do a cut-n-paste of this and let us know.
Code:
RadioCount = 1
For xx = intFirstRec to intLastRec
	strSQL = "UPDATE tblResultsData SET " _
	       & "intAScore = '" & Request.Form("QA" & cStr(RadioCount)) & "', " _
	       & "intBScore = '" & Request.Form("QB" & cStr(RadioCount)) & "' " _ 
	       & "WHERE intCompetency_obj_no = " & cStr(xx) 
	jConn.Execute (strSQL)

	RadioCount = RadioCount + 1
Next
    
jConn.Close
set jConn = Nothing

PS: If you're data is coming across in the QueryString then you need to replace Request.Form with Request.Querystring.
 
Sheco
Works a treat - many, many thanks.
Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top