OLE DB handles Excel error UPDATE "Operation must use an updateable query"

Source: Internet
Author: User
Tags ole

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.