没有人帮忙吗?是不是给的分太少了?

解决方案 »

  1.   

    我是用DataReader

    if (dataReader.Read())
    {
    string filename = dataReader.GetSqlValue(0).ToString();
    long byteSize = dataReader.GetBytes(2,0,null,0,0);
    byte[] ImageData = new byte[byteSize];
    dataReader.GetBytes(2,0,ImageData,0,(int)byteSize);

    Response.Clear();
    Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                    Response.ContentType = "application/octet-stream";
    Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename));
    Response.BinaryWrite(ImageData);
    Response.End();
    }