50 Response.ContentType = "APPLICATION/OCTET-STREAM"; 51 Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(strFileName)); 52 Response.Buffer = true; 53 Response.BinaryWrite((byte[])sdr["FileBody"]); 54 55 //Response.Clear(); 56 //Response.ContentType = "application/octet-stream"; 57 /**/////Response.AddHeader("Content-Type", sdr["FileType"].ToString()); 58 //Response.BinaryWrite((byte[])sdr["FileBody"]); 59 } 60 } 61 //conn.Close(); 62 63 /**//* 64 SqlDataAdapter da = new SqlDataAdapter(strSQL, conn); 65 SqlCommandBuilder MyCB = new SqlCommandBuilder(da); 66 DataSet ds = new DataSet("MyImages"); 67 byte[] MyData = new byte[0]; 68 da.Fill(ds, "MyImages"); 69 DataRow myRow = ds.Tables["MyImages"].Rows[0]; 70 String strFileName = Convert.ToString(myRow["FileName"]); 71 MyData = (byte[])myRow["FileBody"]; 72 int ArraySize = new int(); 73 ArraySize = MyData.GetUpperBound(0); 74 FileStream fs = new FileStream(@"C:\\Download\" + strFileName, 75 FileMode.OpenOrCreate, FileAccess.Write);
上一篇:一步一步教你做 参加MSN与雅虎通互通测试
下一篇:ASP.NET2.0下利用javascript实现TreeView中的checkbox全选
|