3

3000 を超えるレコードを含む Excel シートがあり、のような式を持つ特定の列の値を更新したいと考えています=N8*(1+Q8)

System.Data.OleDb.OleDbConnection connection;
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();

string query = null;
connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + sourcefile + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";");
connection.Open();
cmd.Connection = connection;

query = "Update [Data$] Set [" + Column1 + "] = '" + value1 + "' where ShortCust Like '%" + customername + "%' AND ShortProd Like '%" + productname + "%'";

cmd.CommandText = query;
cmd.ExecuteNonQuery();

connection.Close();

このアプリケーションを実行して更新すると、エラーが発生します

「'(expression)' を更新できません。フィールドは更新できません。」

この Excel 列を更新するにはどうすればよいですか?

4

0 に答える 0