求一个如何用ASP代码实现以二进制形式存储在ACCESS数据库多张图片滚动的显示
我已经上传了几张图片,数据库里也有了图片的二进制信息,我下面这段代码只能显示一张,请问如何显示多张图片.我的表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
%>
</body>
</html>
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>
dispic.asp代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
'以下连接数据库,建立一个Connection对象实例conn
'Dim conn,strConn
Set connGrap=Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("wwwlink.mdb")
connGrap.Open strConn
Dim rs,sql
%>
<table width="40%" border=0 align=center cellpadding=0 cellspacing="0" cellspace="0">
<tr>
<td>
<%
set rs=server.CreateObject("adodb.Recordset")
sql="select * from images order by id DESC"
rs.open sql,connGrap,1,1
%>
<img src="show.asp?id="&rs("id")&"">
</td>
</tr>
</table>
</body>
</html>