Unable to cast object of type 'ADODB.InternalParameter' to typ

Unable to cast object of type 'ADODB.InternalParameter' to typ

Page 1 of 1

0 Replies - 2161 Views - Last Post: 27 June 2010 - 07:36 PM Rate Topic: -----

#1 hariparam09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-June 10

Unable to cast object of type 'ADODB.InternalParameter' to typ

Posted 27 June 2010 - 07:36 PM

I have migrated a vb6 project to VB9 and while running the application, I am getting the exception:

Unable to cast COM object of type 'ADODB.ParameterClass' to class type 'ADODB.InternalParameter'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.


Flow of code:

Step 1:

Dim parmConvCode As ADODB.Parameter
parmConvCode = New ADODB.Parameter

With parmConvCode
.Name = "v_convid"
.Type = ADODB.DataTypeEnum.adInteger
.Direction = ADODB.ParameterDirectionEnum.adParamInput
.Value = 5002
End With

lngReturn = ExecuteProc(m_RecSet, READ_TMS_PRIORITY_CODE, strError, parmConvCode)

step 2:

Public Function ExecuteProc(ByRef p_rsNewRS As ADODB.Recordset, ByVal p_strProcName As String, ByRef p_strError As Object, ByVal ParamArray p_Parms() As Object) As Integer

Dim MyCommand As ADODB.Command
Dim param As ADODB.InternalParameter

param = MyCommand.CreateParameter("RETURN_VALUE", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamReturnValue, 4, System.DBNull.Value)
MyCommand.Parameters.Append(param)

MyCommand.Parameters.Append(p_Parms(i)) ' error here


Unable to cast COM object of type 'ADODB.ParameterClass' to class type 'ADODB.InternalParameter'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

Please help me, t

Is This A Good Question/Topic? 0
  • +

Page 1 of 1