/// <summary> /// 执行带一个存储过程参数的的SQL语句。 /// </summary> /// <param name="SQLString">SQL语句</param> /// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param> /// <returns>影响的记录数</returns> public static int ExecuteSql(string SQLString, string content) { using (OracleConnection connection = new OracleConnection(connectionString)) { OracleCommand cmd = new OracleCommand(SQLString, connection); Oracle.ManagedDataAccess.Client.OracleParameter myParameter = new Oracle.ManagedDataAccess.Client.OracleParameter("@content", OracleDbType.NVarchar2); myParameter.Value = content; cmd.Parameters.Add(myParameter); try { connection.Open(); int rows = cmd.ExecuteNonQuery(); return(rows); } catch (Oracle.ManagedDataAccess.Client.OracleException E) { throw new Exception(E.Message); } finally { cmd.Dispose(); connection.Close(); } } }
public int UpdateFileStatus(int id, int status, string userId) { var paramArray = new List <OracleParameter> { new OracleParameter("V_ID", OracleDbType.Int32) { Value = id }, new OracleParameter("V_Status", OracleDbType.Int32, ParameterDirection.InputOutput) { Value = status }, new OracleParameter("V_UserId", OracleDbType.NVarchar2) { Value = userId }, }; OracleParameter outPar = new OracleParameter(); outPar.ParameterName = "V_Result"; outPar.DbType = DbType.Int32; outPar.Size = 400; outPar.Direction = ParameterDirection.Output; paramArray.Add(outPar); return(ExecNonQuerySpWithResult("UpdateFileStatus", paramArray.ToArray())); }
public void ImportDataTable(Cells c) { DataTable tableData = ImportWorkSheet(c); using (var con = new OracleConnection(Connectionstr)) { con.Open(); var cmdText = "INSERT INTO Cofeed VALUES( "; for (var i = 0; i < tableData.Columns.Count; i++) { cmdText += ":v" + i + ","; } cmdText += "sysdate,null)"; var cmd = new OracleCommand(cmdText, con); for (var j = 0; j < tableData.Rows.Count; j++) { cmd.Parameters.Clear(); for (var i = 0; i < tableData.Columns.Count; i++) { var par = new OracleParameter("v" + i, OracleDbType.NVarchar2) { Direction = ParameterDirection.Input, Value = tableData.Rows[j][i].ToString() }; cmd.Parameters.Add(par); } cmd.ExecuteNonQuery(); } con.Close(); } }
//string conStr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.130.23)(PORT=8903))(CONNECT_DATA=(SERVICE_NAME = settle_primary)));User Id=settle;Password=settle;"; static void Main123(string[] args) { ArrayList arr = GetAttId1(); using (OracleConnection conn = new OracleConnection(conStr)) { conn.Open(); for (int i = 0; i < arr.Count; i++) { double ds = 0; int total = 1; for (int j = 0; j < total; j++) { DateTime startDate = DateTime.Now; OracleParameter[] oracleParameters = new OracleParameter[1]; oracleParameters[0] = new OracleParameter("p_attachmentId", arr[i]); OracleCommand cmd = new OracleCommand("SP_CHECKCINEMA_MT_BYATTID", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddRange(oracleParameters); cmd.CommandTimeout = 1800; cmd.ExecuteNonQuery(); DateTime endDate = DateTime.Now; ds += (endDate - startDate).TotalSeconds; } Console.WriteLine(arr[i] + ":" + ds / total); } conn.Close(); } Console.ReadLine(); }
public void Test([IncludeDataSources(false, ProviderName.OracleManaged)] string context) { var prov = DataConnection.GetDataProvider(ProviderName.OracleManaged); var connectionType = ((DynamicDataProviderBase)prov).GetConnectionType(); var oracleParameter = GetDynamicType("OracleParameter", connectionType); var oracleDbType = GetDynamicType("OracleDbType", connectionType); var oracleDataReader = GetDynamicType("OracleDataReader", connectionType); var oracleDate = GetDynamicTypesType("OracleDate", connectionType); var oracleMapper = new TypeMapper(oracleParameter, oracleDbType, oracleDataReader, oracleDate); // oracleMapper.MapSetter<OracleParameter>(p => p.OracleDbType, () => OracleDbType.Date); var instance = new Oracle.ManagedDataAccess.Client.OracleParameter(); oracleMapper.SetValue <OracleParameter>(instance, p => p.OracleDbType, OracleDbType.Date); var action = oracleMapper.Type <OracleParameter>().Member(p => p.OracleDbType).BuildSetter <IDbDataParameter>(OracleDbType.Single); action(instance); var setterAction = oracleMapper.Type <OracleParameter>().Member(p => p.OracleDbType).BuildSetter <IDbDataParameter>(); setterAction(instance, OracleDbType.Blob); var expr = oracleMapper.MapLambda((OracleDataReader r, int i) => r.GetOracleDate(i)); }
public void Test([IncludeDataSources(false, TestProvName.AllOracleManaged)] string context) { var prov = DataConnection.GetDataProvider(context); var connectionType = ((OracleDataProvider)prov).Adapter.ConnectionType; var oracleParameter = GetDynamicType("OracleParameter", connectionType); var oracleDbType = GetDynamicType("OracleDbType", connectionType); var oracleDataReader = GetDynamicType("OracleDataReader", connectionType); var oracleDate = GetDynamicTypesType("OracleDate", connectionType); var oracleMapper = new TypeMapper(); oracleMapper.RegisterTypeWrapper <OracleWrappers.OracleParameter>(oracleParameter); oracleMapper.RegisterTypeWrapper <OracleWrappers.OracleDbType>(oracleDbType); oracleMapper.RegisterTypeWrapper <OracleWrappers.OracleDataReader>(oracleDataReader); oracleMapper.FinalizeMappings(); var instance = new Oracle.ManagedDataAccess.Client.OracleParameter(); var setterAction = oracleMapper.Type <OracleParameter>().Member(p => p.OracleDbType).BuildSetter <IDbDataParameter>(); setterAction(instance, OracleDbType.Blob); var expr = oracleMapper.MapLambda((OracleDataReader r, int i) => r.GetOracleDate(i)); }
public int LoginUsingPassword(string username, string password) { var result = 0; var userNameParam = new OracleParameter("USERNAME", OracleDbType.Varchar2, username, ParameterDirection.Input); var userPassParam = new OracleParameter("PASSWORD", OracleDbType.Varchar2, password, ParameterDirection.Input); var resultPassParam = new OracleParameter("result_tab", OracleDbType.Int32, ParameterDirection.ReturnValue); using (OracleConnection connection = new OracleConnection(_connectionString)) { OracleCommand cmd = new OracleCommand("LOGINFUNC", connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.BindByName = true; cmd.Parameters.Add(resultPassParam); cmd.Parameters.Add(userNameParam); cmd.Parameters.Add(userPassParam); connection.Open(); cmd.ExecuteNonQuery(); var res = cmd.Parameters["result_tab"].Value.ToString(); result = Convert.ToInt32(res); connection.Close(); // context.SaveChanges(); } return(result); }
public int GetMaxListId(Connection connection) { int max_id = -1; try { if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new Oracle.ManagedDataAccess.Client.OracleCommand("getMaximumListId", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("index_max", OracleDbType.Int32); command.ExecuteNonQuery(); max_id = Int32.Parse(command.Parameters["index_max"].Value.ToString()); connection.Close(); } catch (Exception e) { throw; // connection.Close(); } finally { } return(max_id); }
/// <summary> /// 向数据库里插入图像格式的字段(和上面情况类似的另一种实例) /// </summary> /// <param name="strSQL">SQL语句</param> /// <param name="fs">图像字节,数据库的字段类型为image的情况</param> /// <returns>影响的记录数</returns> public static int ExecuteSqlInsertImg(string strSQL, byte[] fs) { using (OracleConnection connection = new OracleConnection(connectionString)) { OracleCommand cmd = new OracleCommand(strSQL, connection); Oracle.ManagedDataAccess.Client.OracleParameter myParameter = new Oracle.ManagedDataAccess.Client.OracleParameter("@fs", OracleDbType.LongRaw); myParameter.Value = fs; cmd.Parameters.Add(myParameter); try { connection.Open(); int rows = cmd.ExecuteNonQuery(); return(rows); } catch (Oracle.ManagedDataAccess.Client.OracleException E) { throw new Exception(E.Message); } finally { cmd.Dispose(); connection.Close(); } } }
static void Main(string[] args) { //全国院线 OracleParameter[] oracleParameters = new OracleParameter[5]; oracleParameters[0] = new OracleParameter("P_tongjiDay", OracleDbType.Date) { Value = (OracleDate)Convert.ToDateTime("2018-10-25") }; oracleParameters[1] = new OracleParameter("P_startDay", OracleDbType.Date) { Value = (OracleDate)Convert.ToDateTime("2018-04-25") }; oracleParameters[2] = new OracleParameter("P_endDay", OracleDbType.Date, 100) { Value = (OracleDate)Convert.ToDateTime("2018-10-25") }; oracleParameters[3] = new OracleParameter("P_fileName", OracleDbType.Varchar2, 50) { Value = "无双" }; oracleParameters[4] = new OracleParameter("P_CUR", OracleDbType.RefCursor) { Direction = ParameterDirection.Output }; DataTable dt = OracleDBHelper.ExecToStoredProcedureGetTable("SP_GETREPORT_CINEMACODE", oracleParameters); Console.WriteLine(dt.Rows.Count); //* */ Console.ReadLine(); }
public static DbDataReader ProcedureDataReader(this EntitiesContext dbContext, string name, List <KeyValuePair <string, object> > parameters = null) { var pars = new List <OracleParameter>(); if (parameters != null) { foreach (var p in parameters) { var par = new Oracle.ManagedDataAccess.Client.OracleParameter(p.Key, p.Value); //switch (Type.GetTypeCode(p.Value.GetType())) //{ // case TypeCode.Int32: //} //Console.WriteLine(par.Direction.ToString() + par.GetType); pars.Add(par); } } pars.Add(new Oracle.ManagedDataAccess.Client.OracleParameter("P_CUR", Oracle.ManagedDataAccess.Client.OracleDbType.RefCursor) { Direction = System.Data.ParameterDirection.Output }); var conn = dbContext.Database.Connection; var connState = conn.State; //dbContext.Database.SqlQuery() if (connState != System.Data.ConnectionState.Open) { conn.Open(); } var cmd = conn.CreateCommand(); (cmd as OracleCommand).UseEdmMapping = true; cmd.CommandText = name; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddRange(pars.ToArray()); var reader = cmd.ExecuteReader(); cmd.Dispose(); return(reader); }
public IDataParameter CreateImageParameter(string parameterName, byte[] value) { //var p = new OracleParameter(parameterName, DbType.Object); //p.Value = CommOp.TestNull(value); //return p; //张群龙改: var pp = new Oracle.ManagedDataAccess.Client.OracleParameter(parameterName, OracleDbType.Blob, value, ParameterDirection.InputOutput); return(pp); }
public IDataParameter CreateParameter(string parameterName, object value) { if (value is byte[]) { return(CreateImageParameter(parameterName, (byte[])value)); } var p = new Oracle.ManagedDataAccess.Client.OracleParameter(parameterName, CommOp.TestNull(value)); return(p); }
public static bool IsSqlParameterNull(Oracle.ManagedDataAccess.Client.OracleParameter param) { var sqlValue = param.Value; var nullableValue = sqlValue as Oracle.ManagedDataAccess.Types.INullable; if (nullableValue != null) { return(nullableValue.IsNull); } return(sqlValue == null || sqlValue == System.DBNull.Value); }
protected override IDbDataParameter CreateParameter(String name, DataType dataType) { var p = new Oracle.ManagedDataAccess.Client.OracleParameter(name, dataType.DbType.OracleServerDbType.Value); if (dataType is SqlInputParameter dType) { p.Direction = dType.ParameterDirection; } if (p.Direction != ParameterDirection.Output) { p.Value = this.GetParameterValue(dataType, dataType.DbType.OracleServerDbType.Value); } return(p); }
private static XElement ParameterToXElement(OracleParam parameter) { var xelem = new XElement(parameter.ParameterName); if (parameter.OracleDbType == OracleDbType.Clob) { var reader = new StreamReader((Stream)parameter.Value, Encoding.Unicode); xelem.Value = reader.ReadToEnd(); } else { xelem.Value = parameter.Value.ToString(); } return(xelem); }
public static string UpdateFileTopic(DateTime lastSyncTime, DateTime currentSyncTime) { var result = "Success"; using (var IPPDB = new IPPEntities()) { try { IPPDB.Database.Connection.Open(); var cmd = IPPDB.Database.Connection.CreateCommand();; cmd.CommandText = "UpdateFileTopic"; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 0; cmd.Parameters.AddRange(new[] { new OracleParameter("V_LastSyncTime", OracleDbType.TimeStamp) { Value = (OracleTimeStamp)lastSyncTime }, new OracleParameter("V_CurrentSyncTime", OracleDbType.TimeStamp) { Value = (OracleTimeStamp)currentSyncTime } }); OracleParameter outPar = new OracleParameter(); outPar.ParameterName = "V_Result"; outPar.DbType = DbType.String; outPar.Size = 400; outPar.Direction = ParameterDirection.Output; cmd.Parameters.Add(outPar); cmd.ExecuteNonQuery(); var ret = (string)cmd.Parameters["V_Result"].Value; result = ret.Split('!').FirstOrDefault() == "Success" ? "Success" : "Fail"; } catch (Exception ex) { result = "Fail" + ex.Message; } finally { IPPDB.Database.Connection.Close(); } return(result); } }
private static OracleParam CreateOracleParam(OracleParametersForTask parameter, ParameterDirection?direction = null) { var newParam = new OracleParam() { ParameterName = parameter.Name, Value = parameter.Value, OracleDbType = ConvertParameterDataTypeToOracleDbType(parameter.DataType), Size = parameter.Size }; if (direction.HasValue) { newParam.Direction = direction.Value; } return(newParam); }
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); }
public void ExecuteInsertSql(string tableName, DataTable tableData, string minReDate, int paraCount, bool isHasHistoryValue = false) { using (var con = new OracleConnection(Connectionstr)) { con.Open(); var cmd = new OracleCommand("delete " + tableName + " where RE_DATE>='" + minReDate + "'", con); cmd.ExecuteNonQuery(); con.Close(); } using (var con = new OracleConnection(Connectionstr)) { con.Open(); var cmdText = "INSERT INTO " + tableName + " VALUES( "; for (var i = 0; i < paraCount; i++) { cmdText += ":v" + i + ","; } if (isHasHistoryValue) { cmdText += "sysdate,null)"; } else { cmdText += "sysdate)"; } var cmd = new OracleCommand(cmdText, con); for (var j = 0; j < tableData.Rows.Count; j++) { cmd.Parameters.Clear(); for (var i = 0; i < paraCount; i++) { var par = new OracleParameter("v" + i, OracleDbType.NVarchar2) { Direction = ParameterDirection.Input, Value = tableData.Rows[j][i].ToString() }; cmd.Parameters.Add(par); } cmd.ExecuteNonQuery(); } con.Close(); } }
public List <Products_Info> GetDbProductsList(Connection connection, int id) { try { if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new Oracle.ManagedDataAccess.Client.OracleCommand("returnCartPro", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; List <Products_Info> products_Info_list = new List <Products_Info>(); command.Parameters.Add("ID_INPUT", OracleDbType.Int32, System.Data.ParameterDirection.Input).Value = id; Oracle.ManagedDataAccess.Client.OracleParameter p_rc = command.Parameters.Add("rc", OracleDbType.RefCursor, DBNull.Value, System.Data.ParameterDirection.Output); // Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("rc", OracleDbType.RefCursor); // output.Direction = System.Data.ParameterDirection.ReturnValue; command.ExecuteNonQuery(); Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { Products_Info products_Info = new Products_Info( reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetString(4), reader.GetString(5)); products_Info_list.Add(products_Info); } connection.Close(); return(products_Info_list); // return null; } catch (Exception e) { connection.Close(); throw; } }
private static Oracle.ManagedDataAccess.Client.OracleParameter ToOracle(this Oracle.DTO.OracleParameter parameter) { Oracle.ManagedDataAccess.Client.OracleParameter result = null; if (parameter != null) { object type = null; result = new OracleParameter() { ParameterName = parameter.ParameterName, Value = parameter.Value, Direction = parameter.Direction, OracleDbType = parameter.OracleDbType.ToOracle() }; } return(result); }
public List <Address> getCityStore1(Connection connection, int page) { try { if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new OracleCommand("getCities1", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; List <Address> addressList = new List <Address>(); command.Parameters.Add("page", OracleDbType.Int32, System.Data.ParameterDirection.Input).Value = page; Oracle.ManagedDataAccess.Client.OracleParameter p_rc = command.Parameters.Add("l_cursor", OracleDbType.RefCursor, DBNull.Value, System.Data.ParameterDirection.Output); // Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("rc", OracleDbType.RefCursor); // output.Direction = System.Data.ParameterDirection.ReturnValue; command.ExecuteNonQuery(); Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { Address address = new Address( reader.GetInt32(0), reader.GetString(1)); addressList.Add(address); } connection.Close(); return(addressList); // return null; } catch (Exception e) { connection.Close(); throw; } }
public static System.Array ToOracle(this List <Oracle.DTO.OracleParameter> parameters) { List <Oracle.ManagedDataAccess.Client.OracleParameter> result = null; if (parameters != null) { result = new List <Oracle.ManagedDataAccess.Client.OracleParameter>(); foreach (var item in parameters) { Oracle.ManagedDataAccess.Client.OracleParameter param = item.ToOracle(); if (param != null) { result.Add(param); } } } return(result.ToArray()); }
// retourne un DataSet avec le contenu d'une procedure qui retourne plusieurs résultats public DataSet GetSelectProc(string Nom_Procedure) { using (OracleConnection connection = new OracleConnection(connectionString)) { DataSet dataset = new DataSet(); OracleCommand cmd = new OracleCommand(); cmd.Connection = connection; cmd.CommandText = Nom_Procedure; cmd.CommandType = CommandType.StoredProcedure; OracleParameter curseur = new OracleParameter("curseur", OracleDbType.RefCursor, ParameterDirection.Output); cmd.Parameters.Add(curseur); connection.Open(); cmd.ExecuteNonQuery(); OracleDataAdapter da = new OracleDataAdapter(cmd); da.Fill(dataset); cmd.Dispose(); connection.Close(); return(dataset); } }
public void AddUserToDb(USER user) { var userNameParam = new OracleParameter("USERNAME", OracleDbType.Varchar2, user.USER_NAME, ParameterDirection.Input); var userPassParam = new OracleParameter("PASSWORD", OracleDbType.Varchar2, user.USER_PASSWORD, ParameterDirection.Input); var userGenderParam = new OracleParameter("USERGENDER", OracleDbType.Varchar2, user.GENDER, ParameterDirection.Input); using (OracleConnection connection = new OracleConnection(_connectionString)) { OracleCommand cmd = new OracleCommand("CREATEUSER", connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(userNameParam); cmd.Parameters.Add(userPassParam); cmd.Parameters.Add(userGenderParam); connection.Open(); OracleDataAdapter adapter = new OracleDataAdapter(cmd); cmd.ExecuteNonQuery(); // context.SaveChanges(); } }
public int GetPrice(Connection connection, int list_id) { int total_price = 0; if (connection._connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } var command = new Oracle.ManagedDataAccess.Client.OracleCommand("get_total_price1", connection._connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("list_id", OracleDbType.Int32, System.Data.ParameterDirection.Input).Value = list_id; // 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; Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("total_price", OracleDbType.Int32); command.ExecuteNonQuery(); total_price = Int32.Parse(command.Parameters["total_price"].Value.ToString()); connection.Close(); return(total_price); }
/*empty table Iss_def */ public static string Delete_Iss_Def() { var result = "Success"; using (var Db = new VAVEntities()) { try { Db.Database.Connection.Open(); DbCommand cmd = Db.Database.Connection.CreateCommand(); cmd.CommandText = "vav.DeleteIssDef"; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 0; OracleParameter outPar = new OracleParameter(); outPar.ParameterName = "@Result"; outPar.DbType = DbType.String; outPar.Size = 400; outPar.Direction = ParameterDirection.Output; cmd.Parameters.Add(outPar); cmd.ExecuteNonQuery(); var ret = (string)cmd.Parameters["@Result"].Value; result = ret.Split('!').FirstOrDefault() == "Success" ? "Success" : "Fail"; } catch (Exception ex) { result = "Fail" + ex.Message; } finally { Db.Database.Connection.Close(); } return(result); } }
public int DeleteTopic(int topicID, string userID) { var paramArray = new List <OracleParameter> { new OracleParameter("V_TOPICID", OracleDbType.Int32) { Value = topicID }, new OracleParameter("V_UserID", OracleDbType.NVarchar2) { Value = userID } }; OracleParameter outPar = new OracleParameter(); outPar.ParameterName = "V_RESULT"; outPar.DbType = DbType.Int32; outPar.Size = 400; outPar.Direction = ParameterDirection.Output; paramArray.Add(outPar); return(ExecNonQuerySpWithResult("DeleteTopicByID", paramArray.ToArray())); }
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); }