简体   繁体   English

从.csv将批量数据上载到SQL Server 2008

[英]Upload bulk data into SQL Server 2008 from .csv

I want to let my users to upload 3000-4000 rows of data into SQL Server 2008. I would like to use SqlBulkCopy . 我想让我的用户将3000-4000行数据上传到SQL Server 2008.我想使用SqlBulkCopy What is the best policy to do it? 这样做的最佳政策是什么?

Option A: 选项A:

  • First the .csv file will be uploaded to the server and then SqlBulkCopy operation will be started. 首先将.csv文件上传到服务器,然后启动SqlBulkCopy操作。

Option B: 选项B:

  • Read .csv file from user's pc and then send that data to the server. 从用户的PC上读取.csv文件,然后将该数据发送到服务器。

I am new to ASP.Net. 我是ASP.Net的新手。

Thank you. 谢谢。

It really depends on your scenario and what you mean by 'fastest'. 这实际上取决于你的情景以及你对'最快'的意思。 To "load" the data server side (meaning, option A, upload, then import) will almost certainly be faster on the server side. 在服务器端,“加载”数据服务器端(意思是,选项A,上传,然后导入)几乎肯定会更快。 But you could also 'process' the data client side and launch an async uploader if the user experience is more important. 但是,如果用户体验更重要,您还可以“处理”数据客户端并启动异步上传器。

I would go with Option A just to keep the 'upload' decoupled from the 'import' process. 我会使用选项A来保持“上传”与“导入”过程分离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM