一个小问题..在线等~~~

lxrcher 2006-04-11 10:18:05
<%

Response.Expires = 0

Response.buffer=True

Response.clear

'创建对象实例

Set imgConn=Server.CreateObject("ADODB.Connection")

StrConn="DBQ="+server.mappath("test.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"

imgConn.open strConn

Set Rs= Server.CreateObject("ADODB.RecordSet")

Sql="Select img From img Where id=1" '这里的id可以使用Request(“id”)获得

Rs.open sql,imgConn,1,1

Response.ContentType="image/*"
Response.BinaryWrite Rs.("img").GetChunk(7500000)

'关闭和释放对象

Rs.close

ImgConn.close

Set Rs=Nothing

Set ImgConn=Nothing

%>

这是那段把图片上传到数据库并显示出来的代码......为什么我的这一行Response.BinaryWrite Rs.("img").GetChunk(7500000)老提示缺少表示符呀....弄了好久了 都不知道是什么原因


...全文
116 3 打赏 收藏 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sxsgssgs 2006-04-11
  • 打赏
  • 举报
回复
楼上正解
jspadmin 2006-04-11
  • 打赏
  • 举报
回复
Response.BinaryWrite Rs.("img").GetChunk(7500000)
晕倒,你没发现你的rs后多个点么?
Response.BinaryWrite Rs("img").GetChunk(7500000)
jspadmin 2006-04-11
  • 打赏
  • 举报
回复
<!--#include file="inc/conn.asp"-->
<%
sql="select * from ole"
set rs=server.createobject("ADODB.recordset")
rs.open sql,conn,1,1
do until rs.eof
id=rs("id")
%>
<img src="showimg.asp?id=<%=id%>">
<%
rs.movenext
loop
%>


showimg.asp:
<!--#include file="inc/conn.asp"-->
<%
id=request("id")
if id="" then
id=1
else
id=trim(id)
end if
set rs=server.createobject("ADODB.recordset")
sql="select * from ole where id="&id
rs.open sql,conn,1,1
Response.ContentType="image/*"
Response.BinaryWrite rs("ole").getChunk(8000000)
rsclose()
connclose()
%>

28,402

社区成员

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

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