Get the App
SLTechnology News&Howtos  ›  Development  › 

How the SqlCommandBuilder class batch updates excel or CSV data

Shulou Source: shulou.com Published: 2022-06-03 16:33:20 11月14日 Update

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

Tags: Updates data parameters conditions characters databases methods contents names strings methods more articles processing good practical concise personal transaction just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn NVidia Shulou Technology Shulou Tech Info