当前位置: 代码迷 >> .NET Framework >> winfrom读取excel前判断excel是否已经打开,该如何解决
  详细解决方案

winfrom读取excel前判断excel是否已经打开,该如何解决

热度:79   发布时间:2016-05-01 23:45:42.0
winfrom读取excel前判断excel是否已经打开
winfrom读取excel前判断excel是否已经打开,已经打开的话会报错所以判断一下打开就提示终止了
------解决方案--------------------
try
{
   Stream s = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.None);

   s.Close();

   return true;
}
catch (Exception)
{
   return false;
}
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
  相关解决方案