c# - Getting "Cannot access file exception -


i getting following exception. "comexception unhandled" "can not access file_name.xls"

string currentdir=directory.getcurrentdirectory();  if (defaultbuttonclicked) {  _csvfilepath = path.combine(currentdir, "file name_" + datetime.now.adddays(-1).tostring("mm-dd-yyyy") + ".xls");                     defaultbuttonclicked = false;  }  else if (datespecificsearchbuttonclicked)                 {                     var datetemp = calchoosedate.value.tostring("mm-dd-yyyy");                     _csvfilepath = path.combine(currentdir, "file name_" + datetemp + ".xls");                     datespecificsearchbuttonclicked = false;                 }   workbook.saveas(_csvfilepath, excel.xlfileformat.xlopenxmlworkbook, type.missing, type.missing, true, false, excel.xlsaveasaccessmode.xlnochange, type.missing, type.missing, type.missing, type.missing, type.missing);                  workbook.close(true, misvalue, misvalue);                 system.runtime.interopservices.marshal.releasecomobject(application) 


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -