PRB: Passing Parameters By Reference to a VC COM ObjectID: Q197957
|
When passing a parameter to a COM Component's method in Active Server Pages
(ASP) using VBScript, either the following error occurs:
Microsoft VBScript runtime error '800a000d' Type mismatch
VBScript will pass parameters to a method by value if the argument's data type is NOT declared as a variant and the parameter is passed by reference if the argument's data type is declared as variant by the method.
Parameters to be passed as [out] parameters (that is, by reference) to a method should always be declared as a pointer to a variant data type by the method, while [in] parameters (that is, passed by value) can be declared as any type.
This behavior is by design.
Method Name: ByRefMethod
Parameters : [out]BSTR* bstrVal
STDMETHODIMP CByRefObj::ByRefMethod( BSTR* bstrVal )
{
CComBSTR bstrRtnVal = L"This variable is passed by Reference";
*bstrVal = bstrRtnVal.Detach();
}
<%
Dim objTest, strByRefVal
Set objTest = Server.CreateObject("ByRefProj.ByRefObj")
objTest.ByRefMethod strByRefVal
%>
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'ByRefMethod'
Keywords : kberrmsg kbASP kbCOMt kbVBScript kbGrpASP
Version : WINNT:5.0,6.0
Platform : winnt
Issue type : kbprb
Last Reviewed: May 25, 1999