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.MissingMethodExcept ion 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.adUseCl ient
.LockType = LockTypeEnum.adLockBatchOp timistic
' 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
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.MissingMethodExcept
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.adUseCl
.LockType = LockTypeEnum.adLockBatchOp
' 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
If you are upgrading it, why not use the opportunity to get rid of obsolete technology (ADODB) at the same time?
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Issue was completely related to differences between ADO 2.8 and 2.5.
ASKER
Issue was completely related to differences between ADO 2.8 and 2.5. Found on my own.