输出数据库文件到客户端
//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();
//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();