显示数据库中的图像

随声附和 提交于 2020-03-21 07:38:54
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"



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!