Du använder I i den första loopen, då kan du inte använda den i en loop innuti den loopen. döp om den andra loopens I till ILoop eller någon så ska det fungera.
/Viktor
3 svar · 267 visningar · startad av trexter.com
For I=0 to UBound(arrRecords,2)
strSQL = "SELECT * From Poll_answers WHERE id = " & arrRecords(1,I) & " ORDER BY id DESC"
Set RecSet = Connect.Execute(strSQL)
arrRecords2 = RecSet.GetRows
RecSet.Close
Set RecSet = Nothing
For I=0 to UBound(arrRecords2,2)
Response.Write arrRecords2(1,I)
Next
Next
Microsoft VBScript compilation error '800a0410'
Invalid 'for' loop control variable
/v2/other/oldpolls.asp, line 21
For I=0 to UBound(arrRecords2,2)
-----^
:)
Du använder I i den första loopen, då kan du inte använda den i en loop innuti den loopen. döp om den andra loopens I till ILoop eller någon så ska det fungera.
/Viktor
Tack. Nytt fel:
For I=0 to UBound(arrRecords,2)
strSQL = "SELECT * From Poll_answers WHERE id = " & arrRecords(0,I) & " ORDER BY id DESC"
'Response.Write strSQL
'Response.End
Set RecSet = Connect.Execute(strSQL)
[b] arrRecords2 = RecSet.GetRows[/b]
RecSet.Close
Set RecSet = Nothing
For ILoop=0 to UBound(arrRecords2,2)
Response.Write arrRecords2(1,ILoop)
Next
Next
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/v2/other/oldpolls.asp, line 20
:)
Du måste ha en kontroll om du fick något resultat
For I=0 to UBound(arrRecords,2)
strSQL = "SELECT * From Poll_answers WHERE id = " & arrRecords(0,I)
'Response.Write strSQL
'Response.End
Set RecSet = Connect.Execute(strSQL)
if not recset.eof then
arrRecords2 = RecSet.GetRows
RecSet.Close
Set RecSet = Nothing
For ILoop=0 to UBound(arrRecords2,2)
Response.Write arrRecords2(1,ILoop)
Next
end if
Next