• 2 replies
  • Latest Post - ‏2012-09-27T20:58:03Z by ldubois
2 Posts

Pinned topic Anyone see what is wrong with this???

‏2012-09-27T18:07:15Z |

Public Function insertRegUser(ByVal strSCHEMA As String, ByVal strStoredProc As String, ByVal passdata As String, ByVal conn As String) As String Dim errdataReturn As String = 
"" grabDB2Conn(conn) con.Open() Dim trans As DB2Transaction = con.BeginTransaction Dim cmd As DB2Command = con.CreateCommand Dim procCall As String = 
"CALL " + strSCHEMA + 
"." + strStoredProc + 
"(@passdata, @errdata)" cmd.Transaction = trans cmd.CommandType = CommandType.Text cmd.CommandText = procCall 
' Register input-output and output parameters for the DB2Command cmd.Parameters.Add(New DB2Parameter(
"@passdata", passdata)) Dim errdata As DB2Parameter = New DB2Parameter(
"@errdata", DB2Type.Char) errdata.Direction = ParameterDirection.Output cmd.Parameters.Add(errdata) 
' Call the stored procedure cmd.ExecuteNonQuery() Dim errdataDR As DB2DataReader = CType(cmd.Parameters(
"@errdata").Value, DB2DataReader) While errdataDR.Read errdataReturn = errdataDR.GetChar(1) End While errdataDR.Close() Return errdataReturn End Function
Updated on 2012-09-27T20:58:03Z at 2012-09-27T20:58:03Z by ldubois
  • Fetty410
    2 Posts

    Re: Anyone see what is wrong with this???

    Here is the error
    ERROR 39004 IBMDB2 SQL0470N The user defined routine "2" (specific name "") has a null value for argument "" that could not be passed.
  • ldubois
    61 Posts

    Re: Anyone see what is wrong with this???

    Try initializing your output parameter to something before calling the stored procedure. I'm guessing your error is happening because you are passing in a null value, but the output parameter is declared as "not null".