标签:批量向数据库添加数据
C#批量向数据库增加数据: ----------------------------- using (var dbPlatform = DbContext.PlatformWorkCreate()) { var CId = dbPlatform.Query<LQ_WaWaShowCategory>().Where(t => t.CategoryNameEn == "dianzijiaocai").Select(t => t.Id).FirstOrDefault(); for (int i = 0; i < model.SelectedIds.Count; i++) { LQ_PublicResourceOutline dmodel = null; dmodel=new LQ_PublicResourceOutline(); dmodel.LQ_OutlineId = model.SelectedIds[i]; dmodel.CategoryId = CId; dmodel.PublishStatus = 0; dmodel.Summary = ""; dbPlatform.Add(dmodel); } dbPlatform.SaveChanges(); }
标签:批量向数据库添加数据
原文地址:http://dingzhaoqiang.blog.51cto.com/5601059/1752100