Trying VB .NET.
CREATE PROCEDURE A(A INTEGER, OUT B CHAR(1)) BEGIN SET B = 'C'; END
In VB, opened a standard form, associated the .NET dll, in the code
added Imports IBM.Data.DB2, and added the following code to form1.load.
Dim DB As DB2Connection
Dim Command As DB2Command
Dim Parameter1 As DB2Parameter
Dim Parameter2 As DB2Parameter
DB = New DB2Connection("[dbstring]")
DB.Open()
Command = DB.CreateCommand
Command.CommandType = CommandType.StoredProcedure
Command.CommandText = "[schema].A"
Parameter1 = New DB2Parameter("A", DB2Type.Integer, 0,
ParameterDirection.Input, True, 0, 0, "A", DataRowVersion.Current, 0)
Parameter2 = New DB2Parameter("B", DB2Type.Char, 1,
ParameterDirection.Output, True, 0, 0, "B", DataRowVersion.Current, "")
Command.Parameters.Add(Parameter1)
Command.Parameters.Add(Parameter2)
Command.ExecuteNonQuery()
MsgBox(Command.Parameters.Item("B").Value)
DB.Close()
That works perfectly. Yet, if i change the order of the parameters That
is, i change:
Command.Parameters.Add(Parameter1)
Command.Parameters.Add(Parameter2)
to:
Command.Parameters.Add(Parameter2)
Command.Parameters.Add(Parameter1)
I recieve an error:
An unhandled exception of type 'System.ArgumentException' occurred in
microsoft.visualbasic.dll
Additional information: Argument 'Prompt' cannot be converted to type
'String'.
Through other testing, i think i saw that passing the name of the
parameter is completely ignored, as only the order they are added is
used.
Am i doing something wrong? Is name instead of order supported?
B.