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

using redim to populate a database

Status
Not open for further replies.

mmarkym

Programmer
Mar 23, 2002
54
US
I'm trying to retreive from a cookies collection and pass each value into a variable, an array called strCookie().
when I redim the array inside a for next loop, I get this error....

Error Type:
Sun ONE ASP VBScript runtime (0x800A000D)
Type mismatch

the code is....

<%

dim iCount
dim objRS
dim objConn
dim strConnectionString
dim strCookie()

For iCount = 1 To Request.Form("menu").count
Response.Cookies("menu" & " " & iCount & " ") = Request.Form("menu")(iCount)
Next

'Loop through each Cookie
For Each x in Request.Cookies(x)
redim strCookie(x) 'this is the line the error refers to..
strCookie(x) = Request.cookies(x)

response.write strCookie(x)

Next
 
Had a bit of trouble like this before, think all I had to do was redim the array first OUTSIDE the loop.

Code:
'Loop through each Cookie
<b>redim strCookie(0)</b>
For Each x in Request.Cookies(x)
redim strCookie(x)  'this is the line the error refers to..
     strCookie(x) = Request.cookies(x)
     
     response.write strCookie(x)
     
Next

Hope this helps,

Patrick
 
redim strCookie(0)
For Each x in Request.Cookies

now I'm getting the same type mismatch error on this line-------- strCookie(x) = Request.cookies(x)

response.write strCookie(x)

Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top