asp 如何能够显示存在数据库中地图片!!!!???灌水也好,进来看看 (50分)

  • 主题发起人 Fanny501
  • 开始时间
F

Fanny501

Unregistered / Unconfirmed
GUEST, unregistred user!
如题!!!帮帮忙啦!
(注:不是在Delphi中使用asp)
 
显示图片
在一个页面中用<img>方式(图)方式
<img src="theimg.asp?sgbh=<%=request("sgbh")%>&amp;xh=<%=request("ckxh")%>" width=400>

以下是上面程序中的theimg.asp文件
Set rs = Server.CreateObject("ADODB.recordset")
sql="select * from b_hn_sgbb_rtu where sgbh='"&amp;request("sgbh")&amp;"' and xh='"&amp;request("xh")&amp;"'"
rs.open sql,cn,1,1
tu_size=rs("tu").ActualSize '图大小
Response.ContentType = rs("types") '图mime类型
Response.BinaryWrite rs("tu").getChunk(tu_size) '取出图片
 
我去试!!!呵呵 thanks
 
to AIHUA, 以下用法可以吗?我在 Browser上看到地是乱码?能告诉我那里写错了吗?
我刚学asp不好意思!(太XXXX了,对吗)

<!--#include FILE="config.asp"-->
<!-- #include file ="adovbs.asp" -->

<%dim StrSql,rs,tu_size,str %>

<table border="1" align="left" width="100%" cellspacing="1" cellpadding="5"
class="table1">
<tr class="colheader1" >
<td width="14%"><font color=red>出版社名称</font></td>
<td width="20%"><font color=Green ><b>出版社信息</b></font></td>
<td width="26%"><font color=Green ><b>图片</b></font></td>
</tr>
<%
StrSql = "select *from pub_info"'U_News
set rs = DBConn.Execute(StrSql)
Do until rs.EOF
%>
<tr>
<td>
<font color = clblack>
<%=rs("pub_id")%>
</font>
</td>

<td>出版社名称 ^_^</td>
<td>
<font color = green>
<%
tu_size=rs("logo").ActualSize '图大小
Response.ContentType = "image/JPEG" '图mime类型
%>
<img src= <%Response.BinaryWrite rs("logo").getChunk(tu_size)%> >
</font>
</td>
</TR>

<%rs.MoveNext%>
<%Loop%>
</table>
 
怎么没人关心啊!!!!
我也知道这个做法不好(图片放入数据库),
不过我想知道是怎么实现的。
 
小意思啦
LOOK!!!
<%
'showing.asp
%>
<%
Set conn = Server.CreateObject("ADODB.Connection")
strconn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&amp;server.MapPath("test.mdb")
set rs=Server.CreateObject("adodb.recordset")
conn.open strconn
id=Request("id")
sql="SELECT * FROM imgtable where id="&amp;id
rs.Open sql,conn,1,3
response.contenttype="image/*"
Response.BinaryWrite rs("img")
%>
调用:<img src=showimg.asp?id=<%=rs("id")%>>
-------------------------------------------------------
http://yzding.126.com
 
接受答案!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
920
DelphiTeacher的专栏
D
顶部