[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Interop Error: No matching sub on interface

gordiangossen

11/28/2007 1:29:00 PM

Hello,

I will get a compiler Error when trying to implement an interface,
using ActiveX-types as parameters in VB.NET.
I will explain the problem with ActiveX-ADODB v2.8 but, i can
reproduce the bevaviour with a selfwritten dummy activeX-lib.

DETAILS
- Two VS2005 Projects: A and B.
- Both referencing ADODB v2.8
- Project B defines an interface IFace with a sub (mySub) with one
parameter of type ADODB.CommandTypeEnum
- Project A defines a class (implClass) that with a sub (testImpl)
that implements IFace.mySub


Compiler-error messages:
- Error 1 Class 'implClass' must implement 'Sub mySub(c As
ADODB.CommandTypeEnum)' for interface 'B.IFace'.
- Error 2 'testImpl' cannot implement 'mySub' because there is no
matching sub on interface 'B.IFace'.


My GUESS
I guess that the ADODB-Interop.Assembly, that are automatically
created by VS2005 for each of the projects are different, although
they reference the same?! COM-Class.

Does anyone can explain this behaviour?

Greetings
Gordian Gossen
2 Answers

Phill W.

11/28/2007 1:41:00 PM

0

gordiangossen@googlemail.com wrote:

> I guess that the ADODB-Interop.Assembly, that are automatically
> created by VS2005 for each of the projects are different, although
> they reference the same?!

Because the IDE created the InterOp classes for you, yes; each created
InterOp assembly is a totally different Type from any other (essentially
each one is local to the project into which you "imported" it), /even
if/ they use the same source Dll.

You need to reference the ADODB Primary InterOp Assembly instead, which
gets around this problem.
(Or at least you do with VB'2003).

HTH,
Phill W.

gordiangossen

11/28/2007 1:56:00 PM

0

> You need to reference the ADODB Primary InterOp Assembly instead, which
> gets around this problem. (Or at least you do with VB'2003).

Hello Phill,

1.)
I tried that with References to ADODB 2.7. That works - fine.
I read, VS2005 uses PIA automatically, while adding an reference,
instead of creating a new interop-assembly, if a PIA is registered for
that dll.

==================================

2.)
Microsoft KB says that for ADODB 2.8, there is no PIA . (
http://support.microsoft.com/?scid=kb%3Ben-us%3B910696&x=1...).
-----------------------
Issue 7: You experience problems working with components that expect
ADO 2.8 interfaces
The ADODB PIA that is included with Visual Studio 2005 is the same
component that was included with Visual Studio .NET 2003 and was built
by using the Microsoft .NET Framework 1.1. The ADODB PIA was built to
interact with ADO 2.7 interfaces and has not been updated to work with
ADO 2.8 interfaces.

Therefore, attempts to use the ADODB PIA together with components that
expose ADO 2.8 interfaces will fail. This scenario is not supported
with the ADODB PIA.
-----------------

======================

3.)
Any idea for ADODB 2.8 ? ( we don't want to change ADODB version ) ?

4.)
What do you think about that workaround:

- Project B references the ADODB 2.8 ( VS2005 creates
Interop.Assembly )
- Project A references the Interop.ADODB assembly in obj/Debug/ folder

Thx & Greetings
Gordian