显示数据库中的图像

show.asp----------------图像显示页面
<%
  set rs=Server.CreateObject("ADODB.Recordset")
  sql="select top 1 * from newstable2 order by id desc"
  rs.open sql,conn,1,3
%>
<html>
  新闻文本:<%=rs("text")%><br>
  新闻图像:<% If IsNull(rs("picture"))=false then%><img src=showing.asp?id=<%=rs("id") %>> <% end if %>
</html>


showing.asp----------------图像处理页面
<%
  id=request("id")
  set rs=Server.CreateObject("adodb.recordset" )
  sql="select * from newstable2 where id=" & id
  rs.open sql,conn,1,3
  response.contentype="image/gif"
  response.Binarywrite rs("picture")
%>
如要显示数据库中的word文件,则可用response.contenttype="application/msword"



原文地址:https://www.cnblogs.com/djcsch2001/p/2035754.html