I wrote a test procedure on Oracle that returns a string and a value.
I then tried to execute the SP from VB.Net. Here's the code snippet:
But the line, MsgBox, throws an exception,
Any idea?
Thanks.
venki
VB.NET:
CREATE OR REPLACE PROCEDURE EBMS.p_CSV_Upload
(
P_ERROR OUT VARCHAR2,
P_ERROR_NO OUT Number
)
AS
BEGIN
P_ERROR := 'Test Successful';
P_ERROR_NO := '1';
END;
I then tried to execute the SP from VB.Net. Here's the code snippet:
VB.NET:
Dim queryString As String = "p_CSV_Upload"
Using connection As New OracleConnection(myConnectionString)
Dim command As New OracleCommand(queryString)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("P_ERROR", OracleType.VarChar).Direction
= ParameterDirection.Output
command.Parameters.Add("P_ERROR_NO", OracleType.Int32).Direction
= ParameterDirection.Output
command.Connection = connection
Try
connection.Open()
Dim reader As OracleDataReader = command.ExecuteReader
MsgBox((reader.GetString(0)))
MsgBox((reader.GetInt32(1)))
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
No data exists for the row or column.
Any idea?
Thanks.
venki
Last edited by a moderator: