开发者

Could not load type 'ADODB._Recordset_Deprecated' from assembly 'ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Look, im facing aproblem, it started to give me some headache because im looking and looking and still not luck.

I have to execute a method of a DLL from C#, this DLL was created like 4 years ago in VB 6.0 and it is registered in COM. It uses ADOB.Recordset as returning type of the method that I have to execute (no source code avaialble :S)

I've been searching how to load and execute that DLL.

I was having problems first loading it, I couldn't load it with Server.CreateObject, Assembly.Load, Assembly.LoadFrom so I tried to add it from references of the COM and the visual Studio Imported it in the Bin Folder with the name Interops.[Name of Dll]

When Y try to use it, it gives me compile error it says:

Error   1   No overload for method 'SelArregloCobertura' takes '6' arguments

The parameters are correct, within its type and everything. Pretty sure of this

So I tried to execute it with Reflection this is the code :

 ADODB.Recordset rs = new ADODB.Recordset();       
        string strRamo = "70";
        string strSubramo = "01";
        string strOficina = "070";
        int iClaveSolicitud = 7118;
        string strModulo = "0";
        int iInciso = 1;

        Poliza.clsdNTCoberturaClass oClass = new Poliza.clsdNTCoberturaClass();

        MethodInfo miSelArregloCobertura开发者_运维百科 = oClass.GetType().GetMethod("SelArregloCobertura");
        miSelArregloCobertura.Invoke(oClass, new object[] { "70", "01", "070", 7118, "0", 1 });
        //oClass.SelArregloCobertura(strRamo, strSubramo, strOficina, iClaveSolicitud, strModulo, iInciso);

(I commented up the line that gives me the compile error) And the error is different, is not that compile error it gives me the error in the question

Could not load type 'ADODB._Recordset_Deprecated' from assembly 'ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

When I go to the metadata of the dll it seems like this.

 [Guid("757AC98D-3800-406F-BA47-AEDAF2EBBCDB")]
    [TypeLibType(2)]
    [ClassInterface(0)]
    public class clsdNTCoberturaClass : _clsdNTCobertura, clsdNTCobertura
    {
        public clsdNTCoberturaClass();

        [DispId(1610809344)]
        public virtual ADODB._Recordset_Deprecated SelArregloARenovar(string dFecha1, string dFecha2, string strNumOfic, short strCveAge, string strRamo);
        [DispId(1610809347)]
        public virtual ADODB._Recordset_Deprecated SelArregloCobertura(string strRamo, string strSubRamo, string strNumOfic, int lCveSol, string strModulSol, int lCveInc);
        [DispId(1610809348)]
        public virtual ADODB._Recordset_Deprecated SelArregloCobEst(string strRamo, string strSubRamo, short intCveInc, short intAnio, int lNumRec, string strOficRecl);
        [DispId(1610809349)]
        public virtual ADODB._Recordset_Deprecated SelArregloCobEstim(string strRamo, string strSubRamo, short intCveInc, short intAnio, int lNumRec, string strOficRecl);
        [DispId(1610809346)]
        public virtual ADODB._Recordset_Deprecated SelArregloNvaCobertura(string strRamo, string strSubRamo, string strNumOfic, int lCveSol, string strModulSol, int lCveInc, short intAnio, string strOficRecl, string intnumrec);
        [DispId(1610809345)]
        public virtual ADODB._Recordset_Deprecated SelCobertura(string strRamo, string strSubRamo, string strCveCober);
        [DispId(1610809350)]
        public virtual ADODB._Recordset_Deprecated SelEstCobertura(string strRamo, string strSubRamo, short intAnio, string strOficRecl, int lNumRec, short intCveInc, string strCveCober);
    }

So I think there is a problem with the importing step,

Anyone have an idea of how to make this works, or there is another form to load execute a method from a dll who is registered in COM?

Any help would be really apreciated.

Thanks in advance.


Check Breaking change in MDAC ADODB COM components in Windows 7 Service Pack 1

Warning: this is a looooooooong post, your browser will hang for a while.

Update: Microsoft made a decision to revert back the type library and spin off the new interfaces, see Windows 8 Developer Preview build contains the complete fix of the ADO typelib issue


Microsoft Connect has a page on this, including some workaround info. It has to do with breaking changes to ADODB introduced in Windows 7 SP1.

One of the workarounds is detailed at this Microsoft Support Page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜