批量添加数据
2016-03-17 13:22
417 查看
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(); }
相关文章推荐
- Windows2003下批量添加和导出所有ip BAT脚本
- bat批处理批量修改文件扩展名的方法
- SQL Server中数据行批量插入脚本的存储实现
- 批量文件查找替换功能的vbs脚本
- 将表里的数据批量生成INSERT语句的存储过程 增强版
- PowerShell实现批量重命名文件
- asp批量修改记录的代码
- C#/.Net 中快速批量给SQLite数据库插入测试数据
- asp添加数据实现代码
- Java批量修改文件名的实例代码
- 用python实现批量重命名文件的代码
- oracle+mybatis 使用动态Sql当插入字段不确定的情况下实现批量insert
- 批量杀死MySQL连接的四种方法详解
- Shell脚本批量修改文件后缀名代码分享
- Shell脚本实现批量下载资源并保留原始路径
- php实现refresh刷新页面批量导入数据的方法
- Oracle批量执行sql语句之禁用所有表的外键
- PowerShell批量文件重命名操作实例
- php实现网站文件批量压缩下载功能
- 网站被黑后处理方法及删除批量恶意代码的方法步骤