title: How to insert a new row in excel using oledb c#.net
body: <p>I'm trying my best to insert a new data row in excel file.
  please have a look. i'm facing this problem using C#.net framework (3.5) </p>
  
  <p>code:</p>
  
  <pre><code>try{
         string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\rising rent\\csharp-Excel.xls;Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;MAXSCANROWS=15;READONLY=FALSE;ImportMixedTypes=Text'";
         OleDbConnection conn = new OleDbConnection(ConnectionString);
         conn.Open();
         OleDbCommand cmd = new OleDbCommand("INSERT INTO [Inventory$] (C_DATE) VALUES('555')",conn);
         cmd.ExecuteNonQuery();
         conn.Close();
  
  }
  catch (Exception ex)
  {
         MessageBox.Show(ex.ToString());
  }
  </code></pre>
  
  <p>Error is this please have a look and share your views</p>
  
  <blockquote>
    <p>"System.Data.OleDb.OleDbException: Operation must use an updateable query. at
    System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object&amp; executeResult)
    at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&amp; executeResult)
    at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
    at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
    at RisingRentACar.Inventory.button1_Click(Object sender, EventArgs e) in C:\Users\Hamza Hafeez\Documents\Visual Studio 2015\Projects\RisingRentACar\RisingRentACar\Inventory.cs:line 82"</p>
  </blockquote>