Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch when using COM component

Status
Not open for further replies.

kevink

Programmer
Nov 23, 1999
53
IE
I have a component which opens a db connection and returns the recordset as an array.  When the function is in the ASP page directly, everything works fine,  however when the function is compiled as COM object, I get a "Type mistmatch" error when I try and assign the results to an array in the ASP page i.e. "myResults = objDB.Results"

The function is declared as a variant etc. in the COM object, so I can't understand the problem!

Thanks!
 
This might sound stupid...but here goes,
I had a problem like this when I used an array of variants instead of a variant containing an array.

Dim aryOf Variants () ' problem passing
Dim aryContaintingVariant
Redim aryContaintaingVariant(0)

An array of variants is FIRST an array then with variants,
A variant contaning an array is first a Variant then it contains an array of variants.

Try on a simple ASP.
 
Thanks John,

That was one of my errors - I've got a few simple COM objects working with arrays now. I still have a problem with my main one - that of using Index Server within a COM object.

Using Index Server from the ASP page works fine - put the function into a COM component and I'm back with the Type Mismatch error again!!

Any ideas?

Thanks!
 
I don't know Index Server but you'll have to &quot;wrap&quot; the calls so that you are passing Variants and then call &quot;real&quot; methods in the COMponent and then bass ackwards again. If arrays are involved, you may need For/Next to move element by element i.e. () As Whatever <---> As Variant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top