Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the SqlCommandBuilder class batch updates excel or CSV data

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how the SqlCommandBuilder class can update Excel or CSV data in batches. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

When you work with data in batches, you often use update table1 from table2, which is the simplest way.

But when you update large amounts of data from excel or CSV files, and then use this method, the performance is not good? String concatenation and how many, big data is not the need to group update?

I don't want to test the speed of various methods, because I personally agree with the following methods, welcome everyone's criticism and correction.

The main class I need to use is SqlCommandBuilder.

///DataTable new data to be updated///Corresponding to database table name to be updated///Corresponding to primary key name of database table to be updated///Corresponding to column name set of column to be updated//Condition string qualified in WHERE condition of SQL, can be empty. public static int Update(DataTable table, string TableName, string primaryKeyName, string[] columnName, string limitWhere,int onceUpdateNumber) { if (string.IsNullOrEmpty(TableName)) return 0; if (string.IsNullOrEmpty(primaryKeyName)) return 0; if (columnsName == null || columnsName.Length

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report