国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ASP中從數據庫讀取二進制文件數據代碼

2019-11-18 19:32:32
字體:
來源:轉載
供稿:網友

<%
driver_name1="DRIVER={Microsoft access Driver (*.mdb)}; DBQ=D:/數據庫/TREE.MDB"    '根目錄下數據庫打開語句

  dim search,rs,j
  search="select * from Files where ID=" & request.querystring("ID")
  set my_conn=server.CreateObject ("adodb.connection")
  my_conn.open driver_name1
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.Open search,my_conn,1,3
  if rs.bof or rs.eof then
    response.write "錯誤:找不到該文件"
    response.end
  end if

'設置文件的大小及MIME類型
Function SetForDisplay(field, contentType)
contentType = LCase(trim(contentType))
nFieldSize = field.ActualSize
bytes = field.GetChunk(nFieldSize)
session("Bytes") = bytes
Session("Type") = contentType
End Function

   SetForDisplay RS("File"),rs("FileType")
   'Response.AddHeader "Content-Disposition", "attachment; filename=" & rs("FileName")
   response.contentType = Session("Type")
   response.BinaryWrite Session("Bytes")
   Session("Type") = ""
   Session("Bytes") = ""

  set rs=nothing
  my_conn.close
  set my_conn=nothing
%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 周口市| 梁山县| 旅游| 禹州市| 嵊州市| 南昌县| 东阿县| 清原| 辰溪县| 科尔| 四川省| 尤溪县| 中方县| 左权县| 湖口县| 诸城市| 齐河县| 庆云县| 互助| 吴堡县| 枝江市| 青河县| 田林县| 额尔古纳市| 集贤县| 承德县| 塘沽区| 玉龙| 高邮市| 威海市| 望奎县| 左云县| 梁山县| 休宁县| 都昌县| 双柏县| 安塞县| 舟山市| 宁津县| 进贤县| 吉林省|