晚上加班!!在线求助!!下载BLOB数据之惑。。。
//得到文档名
string wdm = Server.UrlDecode(Request.QueryString[ "TableName "]);
//Response.Write(wdm);
string queryString = "Select 文档名, 文档格式,文档大小,文档数据 From table Where 文档名= ' " + wdm + " ' ";
Response.Write(queryString);
string filetype = " ";
string filename = " ";
//byte[] bytes = null;
Response.Write(queryString);
OracleConnection conn = new OracleConnection( "Data Source=;Persist Security Info=True;User ID=;Password=;Unicode=True ");
OracleCommand cmd = new OracleCommand(queryString, conn);
//try
//{
conn.Open();
OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
//下载文件
if (dr.Read())
{
filename = dr.GetValue(0).ToString();
filetype = dr.GetValue(1).ToString();
Response.Clear();
Response.AddHeader( "Content-Disposition ", "attachment; filename= " + filename + ". " + filetype);
Response.ContentType = "text/ " + filetype;
Response.BinaryWrite((byte[])dr.GetValue(3));
}
dr.Close();
conn.Close();
----------