I am having a small problem using old ADO in VB.NET (i am maintaing old code
so i cant change it back to ADO.NET)
i am trying to create ADODB.Parameter s and then pass them to ADODB.Command
and it seems to fail every time
I have referenced the adodb.dll in PIA to use the old ado., and i am using
ado 2.7
Parameters is an array of ADODB.Parameter
any help would be appreciated it
Kovan,
here is the code (keep in mind my stored procedure parameters match the
parameters in param()
Dim cmd As New ADODB.Command
cmd.CommandText = strSPName
cmd.CommandType = CommandTypeEnum .adCmdStoredPro c
cmd.ActiveConne ction = adoConn
'if we were given a parameters collection, append them to the command
If Not Parameters Is Nothing AndAlso Parameters.Leng th > 0 Then
Dim param As ADODB.Parameter
For Each param In Parameters
cmd.Parameters. Append(param) 'ERROR HAPPENS HERE (InvalidCastExc eption)
Next
End If
cmd.Execute(, , ADODB.ExecuteOp tionEnum.adExec uteNoRecords)
rs = Nothing
so i cant change it back to ADO.NET)
i am trying to create ADODB.Parameter s and then pass them to ADODB.Command
and it seems to fail every time
I have referenced the adodb.dll in PIA to use the old ado., and i am using
ado 2.7
Parameters is an array of ADODB.Parameter
any help would be appreciated it
Kovan,
here is the code (keep in mind my stored procedure parameters match the
parameters in param()
Dim cmd As New ADODB.Command
cmd.CommandText = strSPName
cmd.CommandType = CommandTypeEnum .adCmdStoredPro c
cmd.ActiveConne ction = adoConn
'if we were given a parameters collection, append them to the command
If Not Parameters Is Nothing AndAlso Parameters.Leng th > 0 Then
Dim param As ADODB.Parameter
For Each param In Parameters
cmd.Parameters. Append(param) 'ERROR HAPPENS HERE (InvalidCastExc eption)
Next
End If
cmd.Execute(, , ADODB.ExecuteOp tionEnum.adExec uteNoRecords)
rs = Nothing