How to create and update spreadsheet using OLEDB in C#?
- by vamshi
HI! all
I am creating .xls spreadsheet file using following code
using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\temp.xls;Extended Properties='Excel 8.0;HDR=Yes'"))
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("CREATE TABLE [NewSheet] ([Column1] string, [Column2] string)", conn);
cmd.ExecuteNonQuery();
}
but i am getting an exception at cmd.ExecuteNonQuery();
Exception is: Cannot modify the design of table 'NewSheet'. It is in a read-only database.
Please help me to resolve this
Thank You