Oracle批量插入在C#中的应用
时间:2021-07-01 10:21:17
帮助过:59人阅读
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);
}
Oracle批量插入在C#中的应用
标签:seconds div code watch try acl ndt ram receive