try |
{ |
string connectionString = @"provider=Microsoft.Jet.OLEDB.4.0;data source=C:\Documents and Settings\choogl\Desktop\workbooktest.xls;Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;"""; |
OleDbConnection conn = new OleDbConnection(connectionString); |
OleDbCommand cmdupdate = new OleDbCommand(); |
cmdupdate.Connection = conn; |
cmdupdate.CommandText = "UPDATE [location$] SET name ='park' WHERE ID ='1'"; |
conn.Open(); |
cmdupdate.ExecuteNonQuery(); |
conn.Close(); |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
} |