Thursday, April 28, 2011

How can I return an array from a function in classic asp?

Tried this

Function myfunction()
Dim myArray(1)
myArray(0) = "1"
myArray(1) = "2"

myfunction = myArray
End Function

Dim newarray = myfunction()

And I get 500 error.

I'm using IIS7 with .NET runtime ASP.Net 2.0/3.0/3.5 On Godaddy's free economy hosting if that helps.

From stackoverflow
  • In VBScript, you can't assign a value to a variable on the same line that you declare it. You'll have to change

    Dim newarray = myfunction()
    

    to

    Dim newarray
    newarray = myfunction()
    

0 comments:

Post a Comment