从DataTable或Datagridview保存到SQL [英] Saving To SQL From DataTable Or Datagridview
问题描述
我将数据从excel导入我的应用程序到数据表。
(从1到400行16列)
然后显示在数据网格视图中。
我想保存导入SQL数据库的信息。
我想要什么知道的是:
从数据网格视图到SQL
然后从数据表保存到SQL数据库会有明显的性能保存吗?
或者哪一个最适合用于大量数据保存到SQL?
< blockquote>你没有提到能够更新导入的数据,只是显示,所以如果是我,我会剪掉中间人并从Excel电子表格直接导入SQL Server
请参阅此知识库文章 [ ^ ]
CodeProject中有一些示例包含示例好吧:例如从Excel文件导入数据并构建自动插入脚本导出到Excel文件或导出到SQL Server表 [ ^ ]
请参阅链接 [ ^ ]将datatbale传递给sp并执行进一步的操作。
我认为最好的一个是从数据表中保存。
I import data from excel to my application to a data table.
(From 1 to lets say 400 rows 16 columns)
It is then displayed in data grid view.
I then want to save the information imported to a SQL Database.
What I would like to know is :
Will there be a difference performance wise saving from data grid view to SQL
then saving from data table to SQL database ?
Or which one will be the best to use for a big amount of data saving to SQL?
You haven't mentioned being able to update the data imported, just "displayed", so if it was me I would "cut out the middle man" and import directly into SQL Server from the Excel spreadsheet
See this KB article[^]
There's some stuff with examples in CodeProject as well : e.g. Data Import from Excel File and Build an Automated Insert Script to export into excel file or to export into SQL Server Table[^]
refer this link[^] to pass datatbale to sp and perform the further operations.
I think the best one is saving from the data table.
这篇关于从DataTable或Datagridview保存到SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!