C#---批量导入数据库
来源:互联网 发布:美国新英格兰大学知乎 编辑:程序博客网 时间:2024/05/22 11:55
// 写入数据库 System.Data.DataTable tb1 = new System.Data.DataTable(); tb1.Columns.Add("BuildingID"); tb1.Columns.Add("GXID"); tb1.Columns.Add("GYID"); tb1.Columns.Add("GZID"); for (int i = 0; i < grids.Count; i++) { if (grids[i].Count > 0) { for (int l = 0; l < grids[i].Count; l++) { System.Data.DataRow thisrow = tb1.NewRow(); thisrow["BuildingID"] = grids[i][l].id; thisrow["GXID"] = grids[i][l].x; thisrow["GYID"] = grids[i][l].y; thisrow["GZID"] = grids[i][l].z; tb1.Rows.Add(thisrow); } using (SqlBulkCopy bcp = new SqlBulkCopy("Data Source=localhost;Initial Catalog=GZCover3D;Integrated Security=True") { bcp.BatchSize = grids[i].Count; bcp.BulkCopyTimeout = 1000; bcp.DestinationTableName = "tbBuildingGrid3D"; bcp.WriteToServer(tb1); bcp.Close(); } tb1.Clear(); } }
阅读全文
0 0
- C#---批量导入数据库
- 数据批量导入数据库
- Excel批量导入数据库
- excel批量导入数据库
- excel批量导入数据库
- 数据库信息批量导入到对象(c#)
- 【C#--数据】1.使用SqlBulkCopy批量导入数据库的示例
- 数据批量导入Oracle数据库
- 数据批量导入Oracle数据库
- 数据批量导入Oracle数据库
- 关于批量导入到数据库
- [转]sqlite数据库 批量导入
- weblogic批量导入数据库用户
- android数据库批量导入数据
- 跨数据库批量导入数据
- excel批量导入到数据库
- 批量导入数据到数据库
- Excel批量导入到数据库
- 杭电 1015 Safecracker
- 爬虫之路
- 骁龙 835 人工智能技术:机器学习带来个性化体验
- xiaomi unable to install apk
- 天线开关和双工器
- C#---批量导入数据库
- 迷宫问题(深搜+回溯)
- Windows各端口的作用
- ARM平台下独占访问指令LDREX和STREX的原理与使用详解
- Java中调用Python并得到输出的用法
- Mysql常用
- Java通过Runtime类对系统命令的调用,备份数据库和图片示例
- POJ 2551 Dungeon Master
- C语言进阶之路------关于字符串函数的小例子(用函数连接两个字符串)