Link to home
Start Free TrialLog in
Avatar of Tesla428
Tesla428

asked on

Throwing System.MissingMethodException while trying to append fields to an ADODB recordset in a VSTO Excel Add-in being upgrade from XLA.

I am upgrading/updating an old Excel 2003 XLA Add-in into a Excel 2013 VSTO Add-in.  I manually copied and then pasted the code into the new project and cleared a massive number of errors that mainly had to do with changes in enumeration.

The add-in utilized ADO disconnected recordsets for sorting and filtering.

I added a reference to Microsoft ActiveX Data Objects 2.8 Library into the project and imported ADODB into the module throwing the error.  The intellisense for the objects works as expected.  However, the System.MissingMethodException appears at runtime.  

I know the  method exists and I am unclear on how this is broken.

 Sub CreateRecordSet()

        rs = New ADODB.Recordset
        With rs
            ' prime for use in disconnected mode
            .ActiveConnection = Nothing
            .CursorLocation = CursorLocationEnum.adUseClient
            .LockType = LockTypeEnum.adLockBatchOptimistic

            ' Create columns in your record
            With .Fields
                 .Append("Name", DataTypeEnum.adVarChar, 75)    '  <<---Exception thrown here!!
                .Append("Company", DataTypeEnum.adVarChar, 75)
                .Append("Position", DataTypeEnum.adVarChar, 75)
                .Append("Bed", DataTypeEnum.adVarChar, 15)
                .Append("LifeBoat", DataTypeEnum.adVarChar, 15)
                .Append("RowNumber", DataTypeEnum.adInteger)
                .Append("EmerResp", DataTypeEnum.adBoolean)
            End With
        End With

        rs.Open() ' first open the recordset
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

If you are upgrading it, why not use the opportunity to get rid of obsolete technology (ADODB) at the same time?
Avatar of Tesla428
Tesla428

ASKER

CodeCruiser,

Not above replacing ADODB even though I am sure that it should work.  It was used for the simplicity of being able to use SQL base filtering and sorting.

You are recommending a better solution?
ADO.NET
ASKER CERTIFIED SOLUTION
Avatar of Tesla428
Tesla428

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Issue was completely related to differences between ADO 2.8 and 2.5.
Issue was completely related to differences between ADO 2.8 and 2.5.  Found on my own.