System.Data.OleDb.OleDbDataReader dr = null;
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();
byte[] FileData=null;
string type="";
cmd.CommandText = "select * from FL_FILES where FL_ID=3";
cmd.Parameters.Add(new System.Data.OleDb.OleDbParameter("@FL_ID", System.Data.OleDb.OleDbType.Integer)).Value = TextBox1.Text.Trim();
cmd.Connection = conn;
conn.Open();
dr = cmd.ExecuteReader();
if (dr.Read())
{
FileData = (byte[])dr["FL_DATA"];
type=dr["FL_IMETYPE"].ToString();
}
dr.Close();
conn.Close();
//string fileName="d:\\aaa"+type;
System.IO.FileStream fs = new System.IO.FileStream("d:\\IIS[3]\\CMS\\DOWNLOADS\\aaa"+type, System.IO.FileMode.Create);
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
bw.Write(FileData, 0, FileData.Length);
bw.Close();如何不保存文件到服务器 直接实现读取流下载到浏览器客户端
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();
byte[] FileData=null;
string type="";
cmd.CommandText = "select * from FL_FILES where FL_ID=3";
cmd.Parameters.Add(new System.Data.OleDb.OleDbParameter("@FL_ID", System.Data.OleDb.OleDbType.Integer)).Value = TextBox1.Text.Trim();
cmd.Connection = conn;
conn.Open();
dr = cmd.ExecuteReader();
if (dr.Read())
{
FileData = (byte[])dr["FL_DATA"];
type=dr["FL_IMETYPE"].ToString();
}
dr.Close();
conn.Close();
//string fileName="d:\\aaa"+type;
System.IO.FileStream fs = new System.IO.FileStream("d:\\IIS[3]\\CMS\\DOWNLOADS\\aaa"+type, System.IO.FileMode.Create);
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
bw.Write(FileData, 0, FileData.Length);
bw.Close();如何不保存文件到服务器 直接实现读取流下载到浏览器客户端
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货