我有一個SQL Server表,其中Varbinary(Max)
列基本上是壓縮數據。從sql server下載varbinary數據
我的頁面允許用戶下載此數據(在通常的用戶認證之後)。
它用於工作正常,數據量較小,但隨着時間的推移,數據也越來越大。在出現保存對話框之前,我基本面臨着很多問題,等待時間過長。
代碼:
while (reader.Read())
{
Response.Buffer = false;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/gzip";
Response.AddHeader("content-disposition", "attachment;filename="
+ "vbet_1_1.sdf.gz");
byte[] bytes = (Byte[])reader["backupdata"]; // STUCK HERE
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
在調試器中,我可以看到,
byte[] bytes = (Byte[])reader["backupdata"];
一種情況,即滯後。
我的平臺是ASP.Net與.NET框架4.0,SQL Server 2008中,C#代碼隱藏
我會建議以移動數據保存到文件系統,還有什麼理由你存儲數據在分貝?請參閱此網址的更多細節http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay –
我真的很希望,甚至建議,但這裏的事情需要時間來改變 – arvind