You cannot delete cells from a spreadsheet

Source: Internet
Author: User

When you use OLE DB to manipulate Excel, you are prompted for this error when you delete a table in Excel. Very strange (just as well, Microsoft's things like to give some inexplicable error hints), yesterday can be deleted, today will not delete (just yesterday to today there is really a big deal.) The system Ghost to the SSD, but the operation of the Excel file path has not changed.

specific error message:
{System.Data.OleDb.OleDbException (0x80004005): The cell of the spreadsheet cannot be deleted.


At System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling (Oledbhresult hr)
In System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult (Tagdbparams dbparams, object& executeresult )
In System.Data.OleDb.OleDbCommand.ExecuteCommandText (object& executeresult)
In System.Data.OleDb.OleDbCommand.ExecuteCommand (CommandBehavior behavior, object& executeresult)
In System.Data.OleDb.OleDbCommand.ExecuteReaderInternal (CommandBehavior behavior, String method)
In System.Data.OleDb.OleDbCommand.ExecuteNonQuery ()
In Roadmap_Excel.Form1.button2_Click (Object sender, EventArgs e)

Related code:

Connection string:

//定义OleDB连接字符串            string"Provider=Microsoft.Ace.OleDb.12.0;Persist Security Info=False;""data source="@excelPath";Extended Properties=‘Excel 12.0; HDR=yes; IMEX=10‘";            new OleDbConnection();            conn.ConnectionString = strConn;

To run the deleted code:

                        Try{cmd =NewOleDbCommand ("Drop Table ["+ Roadmaptablename +"]", conn); Cmd.                        ExecuteNonQuery (); }Catch(System.ExceptionEx) {TextBox1.Text + = ("Delete data table failed:"+ ex.                            Message); TextBox1.Text + = ("\ r \ n");//The ISAM does not support the deletion of data in linked tables. cmd =NewOleDbCommand ("Delete from ["+ Roadmaptablename +"]", conn); Cmd.                        ExecuteNonQuery (); }

Really can't find the reason, then delete it manually.


No solution has been found at the moment, and there are no web searches on the Internet.

You cannot delete cells from a spreadsheet

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.