I am currently experiencing very strange behavior from IBM DB2 / ADO command object. I receive the following error when attempting to append the parameters:

ERROR : -2147352571. Type mismatch.
Error Generated at : Provider

As I said, this error occurs when attempting to Manually append the parameter to the cmd objects paramters collection. Is there a better way of retrieving the paramters when the paramters.refresh method does not return data? Must the paramter have a value associated with it prior to appending it to the collection?

If anyone has any suggestions, please share them with me.

My code to build the command object is as follows:

ASP code ...


Dim oCmd
Dim objADO
Set objADO = CreateObject("ADOWrapper.clsADO")
objADO.OpenDB ' Opens the database
set oCmd = CreateObject("ADODB.Command")

oCmd.ActiveConnection = objADO.Conn
oCmd.CommandText = sProcName
oCmd.CommandType = 4 'adCmdStoredProc

If oCmd.Parameters.Count = 0 Then
objADO.OpenRecordset "Select * From SYSIBM.SYSPROCPARMS WHere PROCNAME = '" & UCase(sProcName) & "' Order By ORDINAL"
Do While Not objADO.rs.EOF
Set oParam = New ADODB.Parameter
With oParam
.Name = objADO.rs("PARMNAME")
.Direction = 1 ' adParamInput
Select Case objADO.rs("TYPENAME")
.Type = 3 'adInteger
.Type = 129 'adChar
.Size = objADO.rs("LENGTH")
.Type = 135 'adDBTimeStamp
.Type = 200 'adVarChar
.Size = objADO.rs("LENGTH")
End Select
End With
oCmd.Parameters.Append oParam
Set oParam = Nothing
if err.number <> 0 then 'LOCAL ERROR TRAPPING
TrapError err.number, err.source, err.description
end if
Set objADO.rs = Nothing

' Logic associated with assigned values to the parameters
oCmd.Parameters(1).Value = 'ABC'
oCmd.Parameters(2).Value = 1

Set objADO.rs = oCmd.Execute

Set oCmd = Nothing

' Continue processing




System: Windows 2000 with 512 MB RAM (Test Box); Service Pack 4 running DB2 v7 with Fix Pack 10a

Instance "DB2" uses DB2 code release "SQL07028" with level identifier

"03090105" and informational tokens "DB2 v7.1.0.88", "n030813" and "WR21331".

Data Access components information :

ADO Version: 2.7
DBMS Version: 07.02.0008
OLE DB Version: 02.00
Provider Name: IBMDADB2.DLL
Provider Version: 08.01.0000

Connection String = Provider=IBMDADB2.1;Password=*******;User ID=cwconnect;Data Source=xyz_db;Mode=ReadWrite

Thanks in advance,

William Melvin