How to pass Variant array from ASP to COM?
-
I have been trying (unsuccessfully) to pass an array of Variants to a C++ COM component from an ASP page. I wind up getting a 'Type Mismatch' error when the ASP tries to call the COM method. Below is the ASP and the C++ declarations for what I have tried. Anybody see what I am doing wrong? Thanks in advance! Mike Baker ------------------------- //ASP Dim MyArray(2) Dim MyString Dim MyObj Dim RC MyString = "Hello" MyArray(0) = "One" MyArray(1) = 2 MyArray(2) = MyString Set MyObj = Server.CreateObject(" ... ") RC = MyObj.Method( MyArray ) //C++ #1 STDMETHOD(Method) ( /*[in,out]*/ SAFEARRAY ** pArray, /*[out,retval]*/ long * pnReturnCode ); //C++ #2 STDMETHOD(Method) ( /*[in,out]*/ VARIANT * pArray, /*[out,retval]*/ long * pnReturnCode );
-
I have been trying (unsuccessfully) to pass an array of Variants to a C++ COM component from an ASP page. I wind up getting a 'Type Mismatch' error when the ASP tries to call the COM method. Below is the ASP and the C++ declarations for what I have tried. Anybody see what I am doing wrong? Thanks in advance! Mike Baker ------------------------- //ASP Dim MyArray(2) Dim MyString Dim MyObj Dim RC MyString = "Hello" MyArray(0) = "One" MyArray(1) = 2 MyArray(2) = MyString Set MyObj = Server.CreateObject(" ... ") RC = MyObj.Method( MyArray ) //C++ #1 STDMETHOD(Method) ( /*[in,out]*/ SAFEARRAY ** pArray, /*[out,retval]*/ long * pnReturnCode ); //C++ #2 STDMETHOD(Method) ( /*[in,out]*/ VARIANT * pArray, /*[out,retval]*/ long * pnReturnCode );
I don't know if you already solved your problem. I spent a long time with a C++ component called by a ASP page and I remember that the output parameter can only be a VARIANT* (you have long), perhaps the problem isn't in the input parameter but in the output. Hope it helps. Michela
-
I don't know if you already solved your problem. I spent a long time with a C++ component called by a ASP page and I remember that the output parameter can only be a VARIANT* (you have long), perhaps the problem isn't in the input parameter but in the output. Hope it helps. Michela