请问如何在ASP中列表显示SQL SERVER 中的图片(IMAGE类型)数据

lic1980 2003-08-24 12:16:57
请问如何在ASP中列表显示SQL SERVER 中的图片(IMAGE类型)数据
...全文
58 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jaron 2003-08-24
  • 打赏
  • 举报
回复
images.asp
<%
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from images_lib where FileID='"&request("FileID")&"'"
rs.open sql,myconn,1,3
if not(rs.EOF and rs.BOF and isnull(rs("images"))) then
rs.update
rs("viewtimes")=rs("viewtimes")+1
rs.Update
Response.ContentType = "image/bmp"
Response.BinaryWrite rs("images").getChunk(7500000)
else
Response.Write "no data"
end if
rs.close
set rs=nothing
%>

在列表中用 <img src="images.asp?id=1">
ceocio 2003-08-24
  • 打赏
  • 举报
回复
和显示一般数据一样取出来循环显示就可以了
qianzhipachong 2003-08-24
  • 打赏
  • 举报
回复
show_image.asp

<%
id=request("id")
sqlstr="select * from images_lib where id="&id
rs.open sqlstr,conn,3,4
response.ContentType="image/gif"
response.write rs("image")
%>

image_list.asp

<%if len(rs("image"))>0 then%>
<img src="show_img.asp?id=<%=rs("id")%>" width="100" height="100" border="0">
<%else response.write " no image"%>
<%end if%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧