(工作笔记)数据分批次操作,封装方法(sql添删改查)
2017-10-25 17:13
288 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36333371/article/details/78343778
阅读更多
// // idList为数据总的和,count代表按照多少一组 // public static IList<IList<int>> GetlistGroup(IList<int> idList,int count) { IList<int> templist = null; IList<IList<int>> relist = new List<IList<int>>(); for (int i = 0; i < (idList.Count % count == 0 ? idList.Count / count : idList.Count / count + 1); i++) { templist = new List<int>(); for (int j = 0; j < count; j++) { int index = i * count + j; if (index == idList.Count) { break; } templist.Add(idList[index]); } relist.Add(templist); } return relist; } //调用 IList<IList<int>> relist = GetlistGroup(list,100);
string ids = string.Empty; for (int i = 0; i < relist.Count; i++) { ids =string.Join(",", relist[i].ToArray()); string strSQL = string.Format("update {0} set synstatus = 1 where {1} in ({2})", tableName, idName, ids); }
阅读更多
相关文章推荐
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- 数据统计例子,相关子查询!(SQL 中循环操作一列数据方法)
- sql脚本查询数据库表,数据,结构,约束等操作的方法
- 数据统计例子,相关子查询!(SQL 中循环操作一列数据方法)
- SQL基础(2):数据操作-增删改
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- SQL笔记-第三章,数据的增删改
- web前台工作笔记(时间戳、js中clone的使用、js中动态填充数据注意事项、前台查错方法的学习)
- 直接使用SQL操作Oracle空间数据的原理以及配置方法
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- sql笔记三:表中数据的操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作 原生的查询和执行!!
- 学习笔记---工作和面试中的Sql题目和处理方法
- 封装好的Android对话框Dialog,包含了丰富的dialog样式、点击事件数据回传接口。直接调用封装好的方法即可操作dialog
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作
- Android 之采用execSQL和rawQuery方法完成数据的添删改查操作