Krishna

Krishna

  • NA
  • 1
  • 0

Calling AS/400 (Iseries) Stored Procedure from VB.NET using ODBC

Mar 26 2006 7:07 PM
Please verify this code and let me know where i am going wrong.
This is my first VB.NET program. I am a AS/400 application developer.
when I am executing this code i am getting MCH3601 unmonitored by GETHAWB at statment 000000007. In stored procedure it is INPUT parm declaration statment.

Imports System.Data
Imports System.Data.Odbc

PublicClass Form1
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim HAWB AsChar = " RG150"
Dim HAWB1 As Odbc.OdbcParameter
Dim connString AsString = "DSN=EAGLE2; UID=XXXXX;PWD=XXXXXXX;"
Dim conn As OdbcConnection = New OdbcConnection(connString)
Dim cmd As OdbcCommand = conn.CreateCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText =
"CALL EAFWPTSTPG.GETHAWB"
Dim dr As OdbcDataReader
Dim objParameter = New OdbcParameter()
HAWB1 = cmd.Parameters.Add(
"@HAWB1", Odbc.OdbcType.Char, 10)
HAWB1.Direction = ParameterDirection.Input
HAWB1.Value = HAWB

Try

conn.Open()
dr = cmd.ExecuteReader
If dr.HasRows Then
MsgBox("Data")
Else
MsgBox("No Data")
EndIf

Catch ex As Exception
MsgBox(ex.Message)
Finally
conn.Close()
EndTry

EndSub
End
Class

Thank you very much for the help

Krishna