private void button1_Click(object sender, EventArgs e) { string name = textBoxName.Text; string surname = textBoxSurname.Text; Connection connection = new Connection(); if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new Oracle.ManagedDataAccess.Client.OracleCommand("GETUSERORDERS1", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("nume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value = name; command.Parameters.Add("prenume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value = surname; Oracle.ManagedDataAccess.Client.OracleParameter p_rc = command.Parameters.Add("rc", OracleDbType.RefCursor, DBNull.Value, System.Data.ParameterDirection.Output); List <Order> orders_list = new List <Order>(); // Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("l_cursor", OracleDbType.RefCursor); // output.Direction = System.Data.ParameterDirection.ReturnValue; command.ExecuteNonQuery(); // Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader(); // Dim reader As OracleDataReader DbDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess); // var reader = command.Parameters("rc").Value; while (reader.Read()) { Order order = new Order(reader.GetInt32(0)); orders_list.Add(order); } connection.Close(); seeOrdersForm seeOrdersForm = new seeOrdersForm(connection, orders_list); }
private void previousOrdersBtn_Click(object sender, EventArgs e) { string[] words = greetingLabel.Text.Split(' '); string name = words[1]; string surname = words[2]; Connection connection = new Connection(); if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new Oracle.ManagedDataAccess.Client.OracleCommand("GETUSERORDERS1", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("nume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value = name; command.Parameters.Add("prenume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value = surname; List <Order> orders_list = new List <Order>(); Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("l_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; command.ExecuteNonQuery(); Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { Order order = new Order(reader.GetInt32(0)); orders_list.Add(order); } connection.Close(); seeOrdersForm seeOrdersForm = new seeOrdersForm(connection, orders_list); }