Article ID: 174576 - Last Review: July 13, 2004 - Revision: 2.1 HOWTO: Return Arrays from Server-Side Objects in ASPThis article was previously published under Q174576 SUMMARY
Active Server Pages developers who program in VBScript (VBS) often
encounter "Type Mismatch" errors when they attempt to return arrays form
server-side objects to server-side script code. This article explains how
to do this in VBS version 2.0.
MORE INFORMATION
VBS is not as flexible as Visual Basic when it comes to passing variables
of different types to or from objects. This is because VBS stores all
variables as VARIANTS. Thus, it must convert these VARIANTS to other types
when calling methods on objects.
A common scenario is to call a method on a server-side object that returns an array of strings, or some other type, to ASP. Depending on how the server-side object is coded, this may cause a "Type Mismatch" error in the script. The key to making this work, is declaring the object method to return a VARIANT. Inside the method, store the array of data in a VARIANT and return this variable to the server-side script. The code segments below show a method on a Visual Basic 5.0 object, and the ASP script that calls this method. Visual Basic 5.0 Object Method: | Article Translations
|


Back to the top
