K
Kovan A.
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.Parameters 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.adCmdStoredProc
cmd.ActiveConnection = adoConn
'if we were given a parameters collection, append them to the command
If Not Parameters Is Nothing AndAlso Parameters.Length > 0 Then
Dim param As ADODB.Parameter
For Each param In Parameters
cmd.Parameters.Append(param) 'ERROR HAPPENS HERE (InvalidCastException)
Next
End If
cmd.Execute(, , ADODB.ExecuteOptionEnum.adExecuteNoRecords)
rs = Nothing
so i cant change it back to ADO.NET)
i am trying to create ADODB.Parameters 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.adCmdStoredProc
cmd.ActiveConnection = adoConn
'if we were given a parameters collection, append them to the command
If Not Parameters Is Nothing AndAlso Parameters.Length > 0 Then
Dim param As ADODB.Parameter
For Each param In Parameters
cmd.Parameters.Append(param) 'ERROR HAPPENS HERE (InvalidCastException)
Next
End If
cmd.Execute(, , ADODB.ExecuteOptionEnum.adExecuteNoRecords)
rs = Nothing