Last active
January 3, 2016 20:39
-
-
Save dkalamari/8516726 to your computer and use it in GitHub Desktop.
.NET calling Oracle procedure with Date input parameter and String output parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim conn As New OracleConnection(oradb) | |
conn.Open() | |
Dim cmd As New OracleCommand | |
cmd.Connection = conn | |
cmd.CommandText = "procedure1" | |
cmd.CommandType = CommandType.StoredProcedure | |
cmd.Parameters.Add("p1", OracleDbType.Varchar2).Value = "Test 123" | |
cmd.Parameters.Add("p2", OracleDbType.Date).Value = System.DateTime.Now | |
cmd.Parameters.Add("o1", OracleDbType.Varchar2, 3200) | |
cmd.Parameters("o1").Direction = ParameterDirection.Output | |
cmd.BindByName = True // Very important if input parameters aren't ordered in a way procedure expects them | |
cmd.ExecuteNonQuery() | |
Dim output = cmd.Parameters("o1").Value.ToString() //Saving procedures output parameter to variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment