|
发表于 2020-7-31 17:15:02
|
显示全部楼层
下载:
DataBaseType = System.Configuration.ConfigurationSettings.AppSettings["DataBaseType"].ToString();
string FileType;
string strSql = "SELECT * FROM JXNF_FILE WHERE FILEID="+RecordId;
DataTable dt = Util.DBFactory.NonTransactionPowerPlant.ExecuteDataTable(strSql);
//System.Collections.Specialized.NameValueCollection myCollection = Util.DBFactory.NonTransactionPowerPlant.ExecuteNameValueCollection(strSql);
byte[] FileByte;
int len;
MemoryStream myStream; //创建其支持存储区为内存的流
if (!Object.Equals(dt.Rows,null))
{
myStream = new MemoryStream();
FileType = dt.Rows[0]["FileType"].ToString();
FileByte = (byte[])dt.Rows[0]["FileContent"];
myStream.Write (FileByte, 0, FileByte.Length);
len = FileByte.Length;
Response.ClearHeaders();
Response.ContentType = FileType;
Response.OutputStream.Write(FileByte, 0, len);
Response.Flush();
myStream.Close ();
} |
|