|
发表于 2014-10-18 16:24:42
|
显示全部楼层
private readonly object obj = new object();
public int Insert(List<d_Last30DaysEffectP4PProductsEntity> list)
{
string[] arrSql = new string[list.Count];
for (int i = 0; i < list.Count; i++)
{
arrSql[i] = string.Format(@"insert into d_Last30DaysEffectP4PProducts values (null,'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',{13});",
list[i].ProductAliId, list[i].ProductName.Replace("'", "''"), list[i].P4PShowCnt, list[i].P4PClickCnt, list[i].P4PClickRate,
list[i].P4PSpend, list[i].P4PAvgCost, list[i].SumShowNum, list[i].SumClickNum, list[i].SumClickRate,
list[i].SumVisitorCnt, list[i].SumProdFbRate, list[i].SumProdFbRate, "datetime('now', 'localtime')");
}
int n = 0;
lock (obj)
{
n = UserDataSqliteHelper.ExecuteNonQuery(arrSql);
}
return n;
}
把我的代码拿去该一下试试 |
|