ASP显示以二进制存储在ACCESS数据库的多张图片问题
我已经上传了几张图片,数据库里也有了图片的二进制信息,我下面这段代码只能显示一张,请问如何显示多张图片.我的表images,id,类型自动编号,img,类型OLE.还有个...
我已经上传了几张图片,数据库里也有了图片的二进制信息,我下面这段代码只能显示一张,请问如何显示多张图片.我的表images,id,类型自动编号,img,类型OLE.还有个问题,我如果在加两个字段title,文本类型,name,文本类型,想做为标题,和内容.该如何写代码呢?在网上找了很久都没解决,大家不要建议我传到文件夹下,路径存入数据库哦,我只想弄懂这个问题.请高手指点,最好能给出详细的代码.谢谢.我是新手而已.好了,我给出upload.asp下面代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
response.buffer=true
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13) & chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
Set connGraph=Server.CreateObject("ADODB.Connection")
connGraph.Open "Dbq=" & Server.Mappath("wwwlink.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
set rec=server.createobject("ADODB.recordset")
rec.Open "SELECT * FROM images where id is null",connGraph,1,3
rec.addnew
rec("img").appendchunk mydata
rec.update
rec.close
set rec=nothing
set connGraph=nothing
%>
shou.asp代码如下:
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<%
Response.Expires = 0
Response.buffer=True
Response.clear
Dim connGraph,strsql,rec
Set connGraph=Server.CreateObject("ADODB.Connection")
connGraph.Open "Dbq=" & Server.Mappath("wwwlink.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
set rec=server.createobject("ADODB.recordset")
id=trim(request.querystring("id"))
strsql="select img from images where id=id"
rec.Open strsql,connGraph,1,1
Response.ContentType="image/*"
Response.BinaryWrite rec("img").getChunk(7500000)
rec.close
set rec=nothing
set connGraph=nothing
%>
</body>
</html> 展开
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
response.buffer=true
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13) & chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
Set connGraph=Server.CreateObject("ADODB.Connection")
connGraph.Open "Dbq=" & Server.Mappath("wwwlink.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
set rec=server.createobject("ADODB.recordset")
rec.Open "SELECT * FROM images where id is null",connGraph,1,3
rec.addnew
rec("img").appendchunk mydata
rec.update
rec.close
set rec=nothing
set connGraph=nothing
%>
shou.asp代码如下:
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<%
Response.Expires = 0
Response.buffer=True
Response.clear
Dim connGraph,strsql,rec
Set connGraph=Server.CreateObject("ADODB.Connection")
connGraph.Open "Dbq=" & Server.Mappath("wwwlink.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
set rec=server.createobject("ADODB.recordset")
id=trim(request.querystring("id"))
strsql="select img from images where id=id"
rec.Open strsql,connGraph,1,1
Response.ContentType="image/*"
Response.BinaryWrite rec("img").getChunk(7500000)
rec.close
set rec=nothing
set connGraph=nothing
%>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询