如何組織從服務器數據庫下載文件並在客戶機上打開它?從服務器數據庫上載並打開客戶機上的文件
我的代碼工作,只有當打開頁面時在服務器上:
OracleCommand oracleCom = new OracleCommand();
oracleCom.Connection = oraConnect;
oracleCom.CommandText = "Select m_content, f_extension From " + Session["tableNameIns"] +
" where i_id = " + rowData;
OracleDataAdapter adapter = new OracleDataAdapter();
DataTable tableD = new DataTable();
tableD.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter.SelectCommand = oracleCom;
adapter.Fill(tableD);
string FileName = Path.GetTempPath();
FileName += "tempfile" + tableD.Rows[0][1];
byte[] file = new byte[0];
file = (byte[])tableD.Rows[0][0];
FileStream fs = new FileStream(FileName, FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(file, 0, file.GetUpperBound(0) + 1);
fs.Close();
System.Diagnostics.Process.Start(FileName);