Re: IBM DB2 UDB for iSeries OLE DB Provider questions -
10-30-2005
, 04:14 PM
Dear all,
I am having the same error while trying to invoke a iSeries DB2 stored procedure from VB.Net. Actually the error occured while trying to execute the code such commandName.executeNonQuery. My SP is just a select statement. Following is the VB code:
Dim connection As New Odbc.OdbcConnection
Dim exchCmd As Odbc.OdbcCommand
Dim parmCCY As Odbc.OdbcParameter
Dim parmTOR As Odbc.OdbcParameter
Dim parmBUY As Odbc.OdbcParameter
Dim parmSELL As Odbc.OdbcParameter
Dim sRate As DataSet
Try
connection = Me.OdbcConnection1
exchCmd = New Odbc.OdbcCommand("EXCHANGE(CSD12690)")
exchCmd.Connection = connection
exchCmd.CommandType = CommandType.StoredProcedure
parmCCY = exchCmd.Parameters.Add("PCCY", Odbc.OdbcType.Char, 3)
parmCCY.Direction = ParameterDirection.InputOutput
parmCCY.Value = Currency
parmTOR = exchCmd.Parameters.Add("PTOR", Odbc.OdbcType.Decimal)
parmTOR.Direction = ParameterDirection.Output
parmBUY = exchCmd.Parameters.Add("PBUY", Odbc.OdbcType.Decimal)
parmBUY.Direction = ParameterDirection.Output
parmSELL = exchCmd.Parameters.Add("PSELL", Odbc.OdbcType.Decimal)
parmSELL.Direction = ParameterDirection.Output
connection.Open()
'THE ERROR OCCURED HERE....
exchCmd.ExecuteNonQuery()
sRate= parmCCY.Value & " " & parmTOR.Value & " " & parmBUY.Value & " " & parmSELL.Value
connection.Close()
connection.Dispose()
Catch ex As Exception
sRate = ex.Message
End Try
Return sRate |