Array question

Results 1 to 3 of 3

Thread: Array question

  1. #1
    Join Date
    Dec 1969

    Default Array question

    hi I am trying to dynimacly create an array by doing this...<BR><BR>Dim Employee_Count(totalcount)<BR><BR>&#039;Where totalcount is calculated somewhere else and contain any number<BR><BR>When I run my code I get an error Expected integer constant - can this be done?<BR><BR>Thanks much!

  2. #2
    Join Date
    Dec 1969

    Default Try CInt(TotalCount)...

    ASP has converted TotalCount to a variant, and thus you want to convert it back to an integer.<BR><BR>HTH<BR><BR>Jerry

  3. #3
    Join Date
    Dec 1969

    Default No...wrong answer...

    Read the VBScript docs for the DIM statement.<BR><BR>You can *ONLY* use a TRUE CONSTANT NUMBER to dimension an array:<BR><BR>Dim ar(3182) &#039; okay<BR>Dim ar(3181 + 1) &#039; not okay...not a simple integer constant<BR><BR>The answer is easy:<BR><BR>Dim ar( )<BR>ReDim ar( anyNumericExpressionWhatsoever )<BR><BR>*ONLY* ReDim allows things other than integer constants. Period.<BR><BR>HEY! What does this have to do with Databases???<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