How to force update dependent cell when updated any excel cell using c# code and oledb? My site is hosted in cloud environment. User click on button and at that time my code get required values from database and update the few excel cells and prompt user to download this excel sheet. lots of calucation depends on this updated excel cells.
When I mannually update this cell all calculations works fine but when updating using c# code it is not working.
Pleasse check my Code here
String connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0 XML;HDR=NO\";";
System.Data.OleDb.OleDbConnection MyConnection;
System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
string sql = null;
MyConnection = new System.Data.OleDb.OleDbConnection(connstring);
MyConnection.Open();
myCommand.Connection = MyConnection;
//term in months
sql = "UPDATE [InputSheet$C7:C7] SET F1 = " + model.Lender.ApprovedTerm;
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
//intrest rate
sql = "UPDATE [InputSheet$C8:C8] SET F1 = " + model.Lender.ContractRate;
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
//loan amount
sql = "UPDATE [InputSheet$C9:C9] SET F1 = " + model.Lender.ApprovedLoanAmt;
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
MyConnection.Close();
I don't want to use Open XML. Is there any other way to force update dependent cell?