|
download:
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; //Create a stream whose support storage area is memory
if (!Object.Equals(dt.Rows,null))
{
myStream = new MemoryStream();
FileType = dt.Rows[0]["FileType"].ToString();
FileByte = (byte[])dt.Rows[0]["FileContent"];
To
myStream.Write (FileByte, 0, FileByte.Length);
len = FileByte.Length;
Response.ClearHeaders();
Response.ContentType = FileType;
Response.OutputStream.Write(FileByte, 0, len);
Response.Flush();
myStream.Close ();
} |
|