zoukankan      html  css  js  c++  java
  • Oracle批量插入在C#中的应用

    public void SetUserReportResult(int[] reportId, bool isReceive, string result)
            {
                if (reportId == null)
                    throw new ArgumentNullException("reportId");
                result = result.Left(80);
                string sql = "update msg_user_receive_report set isreceive=" + Convert.ToInt32(isReceive) + ",";
                if (!isReceive)
                    sql += "ukey='0',";
    
                var resultParam = "null";
                if (result != null)
                    resultParam = "'" + result.Replace("'", "''") + "'";
    
                sql += "result=" + resultParam + ",retrycount=retrycount+1,userreceivetime=sysdate where id=:reportId";
                Stopwatch watch;
                using (var connection = this.CreateConnection())
                {
                    using (var command = connection.CreateCommand())
                    {
                        var size = reportId.Length;
                        command.CommandText = sql;
                        command.ArrayBindCount = size;
                        command.Parameters.Add(new OracleParameter("reportId", OracleDbType.Int32) { Value = reportId });
                        connection.Open();
                        watch = Stopwatch.StartNew();
                        var c = command.ExecuteNonQuery();
                        watch.Stop();
                    }
                    connection.Close();
                }
                Trace.TraceInformation("Data.SetUserReportResult,watch=" + watch.ElapsedMilliseconds);
            }
  • 相关阅读:
    D
    C
    如何用最简单的方式解释依赖注入?依赖注入是如何实现解耦的?
    二维数组中的查找
    简单对称算法
    冒泡排序(数组排序)
    二分查找
    斐波那契数列
    顺序查找(数组里查找某个元素)
    二维数组排序算法函数
  • 原文地址:https://www.cnblogs.com/rengke2002/p/7462516.html
Copyright © 2011-2022 走看看