日期:2014-05-19  浏览次数:20395 次

急急!求批量导出的解决方案!
web显示的是数据库的数据(用gridview显示),有很多列.
每一列前都有checkbox,如果选中就导出,每一条记录导出成一个excel文件.
我在本机已经实现,可是上传到服务器上就出现问题
报错位:

The   device   is   not   ready.

Description:   An   unhandled   exception   occurred   during   the   execution   of   the   current   web   request.   Please   review   the   stack   trace   for   more   information   about   the   error   and   where   it   originated   in   the   code.  

Exception   Details:   System.IO.IOException:   The   device   is   not   ready.


Source   Error:  


Line   300:                 {
Line   301:                      
Line   302:                         Directory.CreateDirectory(DownLoadExcelPath.Substring(0,   DownLoadExcelPath.LastIndexOf( '\\ ')));
Line   303:                 }
Line   304:                 Directory.CreateDirectory(DownLoadExcelPath.Substring(0,   DownLoadExcelPath.LastIndexOf( '\\ ')   +   1));

我用的方法是:
  FileStream   fs   =   new   FileStream(name,   FileMode.Create,   FileAccess.Write);
                StreamWriter   sw   =   new   StreamWriter(fs,   System.Text.Encoding.GetEncoding( "gb2312 "));
直接sw.write(string);

请大侠分析下原因.或者提供新的解决方案!
请大侠分析下原因.或者提供新的解决方案!
 


------解决方案--------------------
服务器上 office com 没有权限
------解决方案--------------------
又好像,你在服务器上放excel文件,的文件夹没有写的权限
------解决方案--------------------
sw没关闭
sw.Close()

------解决方案--------------------
怎么会出这种问题 ,帮你顶
------解决方案--------------------
你打印出来DownLoadExcelPath看看是否正确
------解决方案--------------------
路径,权限……
------解决方案--------------------
sw.Close();
关上!呀!
------解决方案--------------------
导出什么样的格式呀
------解决方案--------------------
没有目录写权限,另外在服务器com接口注册时设属性为交互
------解决方案--------------------
帮顶