Passing objects from ASP to VB ActiveX DLL
When passing objects from an ASP to a VB-made ActiveX DLL, I get a type mismatch error (800a000d). I searched the Microsoft KB and found article #Q197956 which is just about this. It tells that VBScript is designed so that any data passed by reference to such a method should be passed as a variant, i.e. the method should define this in/out parameter as a variant (and then convert it into the required object type in the method body).
The problem is that I did it exactly the way it is described, but I still have the same problem...
I have VB6 and VInterDev6 SP3, NT4SP5 with PWS.
>> Code of my VB object method:
-------------------------------------
public Sub DBDelete(varcn as Variant) '<-- here I tried both byref and
' byval with same results
Dim cn as ADODB.Connection
set cn = varcn
cn.Execute "delete from marques where nummar=" + mvarNumMar
End Sub
-------------------------------------
>> Code of my ASP (using JScript,
>> but I tried VBScript with the same result):
-------------------------------------
<%
var cn = Server.CreateObject("ADODB.Connection")
cn.Open("Provider=MSDASQL;DSN=DBAUTO")
var Mar = Server.CreateObject("DBAUTO.Marque")
Mar.NumMar = 4 <-- this one works fine, as any other property
or method using byval args
Mar.DBDelete(cn) <-- error 800a000d 'Type Mismatch' occurs here on 'cn'
cn.Close()
%>
Many thanks in advance !
Philippe Lelong
Directeur du Développement - COM1 - France