|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
<% 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 %> 返回类别: 教程 上一教程: 如何定义一个SESSION数组 下一教程: ASP内置对象详解之OBJECTCONTEXT对象 您可以阅读与"ASP中从数据库读取二进制文件数据代码"相关的教程: · 纯ASP分离FORM数据中的二进制文件和文本数据 · [ASP]向数据库读写image文件 · ASP向数据库读写IMAGE文件 · 用ADODB.STREAM将以二进制方法保存在数据库中的文件保存到硬盘 · 上传图片以二进制插入到数据库,且读取显示 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |