关于DataRow自增的问题
DataTable TT=new DataTable ();
DataRow ce = TT.NewRow();
IList<CallEntity> list = new IList<CallEntity>;
foreach (CallEntity call in list)
{
ce["Id"] = 1;
ce["StoreCode"] = call.StoreCode;///店铺号
ce["StoreName"] = call.StoreName != null ? call.StoreName : "测试店铺";///店铺名
ce["Num"] = 1;///店铺数量
DataRow[] rows = TT.Select("StoreCode='" + call.StoreCode + "'");
if (rows.Length > 0)
{
rows[0]["Num"] = Convert.ToInt32(ce["Num"]) + Convert.ToInt32(rows[0]["Num"]);
}
else
{
TT.Rows.Add(ce.ItemArray);
}
}
return TT;
=============================
上面那个Id是自增列,由于list里面有重复数据,不知道Id怎么写,Id不是在数据库里获取的