When you update data in Excel using C # OLE DB, you find the error {"Operation must use an updateable query."}
The connection logic is as follows:
ConnStr = "provider=microsoft.ace.oledb.12.0;" + "Data source=" + FilePath + ";" + "; Extended properties=\ "Excel 12.0 XML; Hdr=yes;imex=2\ "";
The UPDATE statement is as follows
String sql = "UPDATE [sheet2$] SET val = 66.259 WHERE tid =3;" conn = new OleDbConnection (CONNSTR); Conn. Open (); OleDbCommand cmd = new OleDbCommand (); Cmd. Connection = conn; Cmd.commandtext = SQL; Cmd. ExecuteNonQuery (); Conn. Close ();
Error is operation must use of an updateable query, the beginning of the period that is the UPDATE statement execution failed, how to modify the success;
Verified, the problem appears in ConnStr imex=2, cancel this setting, OK, refer to Popoxxll's blog
This article is from the "No Fly Ants" blog, please be sure to keep this source http://cseck100150.blog.51cto.com/3499398/1792230
OLE DB handles Excel error UPDATE "Operation must use an updateable query"