excel - inserting data with OleDb c#
- by Cmptrb
Hi,
my code is below:
private string connectionstring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myexcel.xls; Extended Properties=""Excel 8.0;HDR=YES;""";
this is my connection string, the excel file is created writable (not readonly)
either my command to insert any data is :
string commandstring = "insert into [mus$] (name, surname) values('mickey', 'mouse')";
But my commandstring does not work and gives the error:
"number of query values and destination fields are not the same"
Where I do mistake ?