杞人忧天上掉下个林妹妹

穿越旷野的妹妹啊,慢些走;请不要用你的沉默告诉我,你不回头!

导航

输出数据库文件到客户端

     //MIME = "application/vnd.ms-excel"; 
     //MIME = "application/octet-stream"; 
     Response.Buffer = true;
     Response.Clear();
     //设置数据流输出类型
     Response.ContentType = MIME;
     //设置文件名
     if(IsOpen == "1")
     {
        //直接打开
      Response.AddHeader("Content-Disposition", "inline; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
     }
     else
     {
        //弹出打开/保存对话框
      Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
     }
    //输出数据库中的文件数据流
     Response.BinaryWrite((byte[])DS.Tables[0].Rows[0].ItemArray[0]);
     Response.Flush();
     DS.Dispose();

posted on 2006-05-18 23:01  杞人  阅读(228)  评论(0编辑  收藏  举报