如我要把
select top 100 * from product order by id desc
这个语句所查询出来的数据存储为Excel格式
谢谢PS:给个相符的URL也可以谢谢

解决方案 »

  1.   

    可以直接在PLSQL Developer查出结果后选中数据右键菜单有直接导入Excel的选项
      

  2.   

    http://dev.10026.com/sql/bclass/2005815701_4146899.shtml
      

  3.   

    http://hi.baidu.com/wuhy/blog/item/b067bca11246fb8b471064db.html
      

  4.   

    System.Web.HttpContext obj = System.Web.HttpContext.Current;
                obj.Response.Clear();
                obj.Response.Buffer = true;
                //obj.Response.Charset="GB2312"; 
                obj.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(strFileName, Encoding.UTF8) + ".xls");
                obj.Response.ContentEncoding = System.Text.Encoding.UTF8;//设置输出流为简体中文
                obj.Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
                obj.Response.ContentType = "application/vnd.ms-excel";
                //System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
                System.IO.StringWriter sw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
                dg.RenderControl(htw);            obj.Response.Write(sw.ToString());
                obj.Response.End();
      

  5.   

    1,使用exec master.dbo.xp_cmdshell 'bcp "select top 100 * from product order by id desc" queryout "d:\xx.csv" -w -S. -Usa   -Psa' 
    2,使用DFVV8((忽然发现,俩裤衩了,向三只裤衩前进!)) 的方法,
    3,使用winform的office类库生成
      

  6.   

    在程序里生成需要用office类库
      

  7.   

    exec master.dbo.xp_cmdshell 'bcp "select top 100 * from product order by id desc" queryout "d:\xx.csv" -w -S. -Usa   -Psa'