Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. string cad = @" Provider=Microsoft.ACE.OLEDB.12.0;" +
  2. @"Data Source=" +
  3. Server.MapPath("~/SVG/" + filenameexport + ".xlsx;") +
  4. @"Extended Properties=" + '"' + "Excel 12.0 Xml;HDR=NO" + '"';
  5. try
  6. {
  7. using (OleDbConnection con = new OleDbConnection(cad))
  8. {
  9. con.Open();
  10. string query = @"UPDATE [Cost Planning$] SET F9= ? WHERE F1 = 'Category'";
  11. using (OleDbCommand cmd = new OleDbCommand(query, con))
  12. {
  13. cmd.Parameters.AddWithValue("@param1", Convert.ToDateTime("2014/07/01"));
  14. cmd.ExecuteNonQuery();
  15. }
  16. con.Close();
  17. }
  18. }
  19.  
  20. ((Excel.Range)worksheetobject.Range("A1")).EntireColumn.NumberFormat = "MM/DD/YYYY";
  21.  
  22. ((Excel.Range)worksheetobject.Range("A1")).EntireColumn.NumberFormat = "MM/DD/YYYY";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement