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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing with querystring and DB (Subscript out of range) 1

Status
Not open for further replies.

cattys

Technical User
Jul 2, 2001
19
DE
Hi there,

hopefully you can help me with this.
I have a querystring like ?4=4,23=23,34=34[+ 2 string values]
I create an array (resultsort) and I sort it to redim it without the string values.
Now comes following code:


<%
For iLoop = LBound(resultsort) to UBound(resultsort)
Response.Write resultsort(iLoop) & &quot;<BR>&quot;
con.Execute(&quot;INSERT INTO [Rel_Person-Department] (Ref_Person, Ref_department) VALUES (&quot;&ID_Person&&quot;, &quot;&CInt(resultsort(i))&&quot;);&quot;)
'response.write(&quot;Successful transmitted!&quot;)
%>
Next


The Table requires 2 integer values and when I look over the code I cannot spy an error (maybe I have coded too much today already)
However, I get the Error:


Microsoft VBScript runtime error '800a0009'

Subscript out of range: '5'


I suppose that '5' must be an error code because there is no value '5' in this array. But I cannot figure it out.
Everything works fine without the con.Execute.

I would be very happy about any hints.

Cattys
 
the error you get is because of this:
...VALUES (&quot;&ID_Person&&quot;, &quot;&CInt(resultsort(i) <-- this is the error. you're trying to fetch an element from the array that deosn't exist. it should be iLoop and not just i...

hope this helps

:)
 
It Helped indeed! Thank you very much.
I was blind #-)

Too many counters etc in the original code, and too many cut'n paste *chuckle*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top