M
Manuel Arroba
asp.net oledb command parameter error calling an as400 program
Hi...
I have an as400 program that I can call it directly and it works:
variable= "xxxx"
sql = "CALL METSIGOP.SIGOPRC ('" + variable + "')"
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection()
cmd = New OleDbCommand()
con.ConnectionString = StrCon
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = sql
con.Open()
Try
cmd.ExecuteNonQuery()
No errors, it works fine.
The program I call, uses a inputouput parameter, so we would like to
check the variable return:
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection()
cmd = New OleDbCommand()
con.ConnectionString = StrCon
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "CALL METSIGOP.SIGOPRC (?)" '
Dim parametro As New OleDbParameter("XURRO",
OleDb.OleDbType.Char, 128)
parametro.Value = "xxxxx"
parametro.Direction = ParameterDirection.InputOutput
cmd.Parameters.Add(parametro)
con.Open()
Try
cmd.ExecuteNonQuery() <=== now I get an error:
SQL: CALL METSIGOP.SIGOPRC ('xxxxx')
Mensaje: SQL0204: SIGOPRC in METSIGOP of type *N not found.
Origen: IBMDA400 Command
SQLState:
Does anyone have any idea about what i am doing wrong ?...
Thanks in adavance... have a nice day..
Miguel Canals (Barcelona, Spain)
Hi...
I have an as400 program that I can call it directly and it works:
variable= "xxxx"
sql = "CALL METSIGOP.SIGOPRC ('" + variable + "')"
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection()
cmd = New OleDbCommand()
con.ConnectionString = StrCon
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = sql
con.Open()
Try
cmd.ExecuteNonQuery()
No errors, it works fine.
The program I call, uses a inputouput parameter, so we would like to
check the variable return:
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection()
cmd = New OleDbCommand()
con.ConnectionString = StrCon
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "CALL METSIGOP.SIGOPRC (?)" '
Dim parametro As New OleDbParameter("XURRO",
OleDb.OleDbType.Char, 128)
parametro.Value = "xxxxx"
parametro.Direction = ParameterDirection.InputOutput
cmd.Parameters.Add(parametro)
con.Open()
Try
cmd.ExecuteNonQuery() <=== now I get an error:
SQL: CALL METSIGOP.SIGOPRC ('xxxxx')
Mensaje: SQL0204: SIGOPRC in METSIGOP of type *N not found.
Origen: IBMDA400 Command
SQLState:
Does anyone have any idea about what i am doing wrong ?...
Thanks in adavance... have a nice day..
Miguel Canals (Barcelona, Spain)