Variant Arrays

Results 1 to 3 of 3

Thread: Variant Arrays

  1. #1
    Join Date
    Dec 1969

    Default Variant Arrays

    I am trying to do what I learned from this WROX book and no dice... I created a variable called VarArray(6) and declared it as Dim VarArray(6) but it gives me this error Type mismatch: &#039;VarArray&#039;<BR><BR>This is the chunk of code I&#039;m attempting so let me know if there are any other errors please...<BR><BR>Dim VarArray(6)<BR> VarArray(0) = rs("username")<BR> VarArray(1) = rs("meetingplace")<BR> VarArray(2) = rs("meetingtime")<BR> VarArray(3) = rs("cfirstname")<BR> VarArray(4) = rs("clastname")<BR> VarArray(5) = rs("comments")<BR> VarArray(6) = rs("orderid")<BR> Dim Variant_Array<BR> Session("Variant_Array") = VarArray<BR><BR>Also how do I break this up on a different page?<BR>Would it be Session("Variant_Array", 0) for the username value?<BR><BR>Thank you,<BR><BR>Keith

  2. #2
    Join Date
    Dec 1969

    Default looks good

    drop the Dim Variant_Array line, you don&#039;t need it (that dims a local variable, not a session var).<BR><BR>Session("Variant_Array")(0) gets your first value.

  3. #3
    Join Date
    Dec 1969

    Default *WHEN* does it give you the error?

    And on what line?<BR><BR>Just a minor comment, too:<BR><BR>You could write that code more succinctly as:<BR><BR>VarArray = Array( rs("username"),rs("meetingplace"),rs("meetingtime" ),rs("cfirstname"),rs("clastname"),rs("comments"), rs("orderid") )<BR><BR>See also the ASPFAQs (link at top right of this page) and the topic "Arrays". Look for FAQ about arrays in session variables.<BR><BR>You *can* do Session("Variant_Array")(0) to retrieve the user name, but it&#039;s very inefficient. Better to copy the array to a local variable in the page, first.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts