How does your connection string look like? Please upload a reproducable sample of your issue to OneDrive and post the link to it here if you cannot solve the issue using the suggestions.
The following code certainly works on my side:
String sConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\Book1.xls;Extended Properties='Excel 8.0;HDR=NO'";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
OleDbCommand myCommand = new OleDbCommand();
myCommand.Connection = objConn;
string stSheetName = "Sheet1";
string sql = "UPDATE [" + stSheetName + "$B2:B2] SET F1='e'";
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
objConn.Close();
Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.
No comments:
Post a Comment