StealthRT
04-03-2009, 07:36 AM
Hey all, i am trying to figure out how to go about loading some images from my database. I have been able to accomplish this with only one image, however. I am looking to loop thought the database and display all images that the query looks for..
Here is my current code:
Pic.asp page
<%
Dim oConnection
Dim oRecordset
Dim Sql
Response.Expires = -10
Response.Buffer = True
Response.Clear
Set oConnection = Server.CreateObject("ADODB.Connection")
Set oRecordset = Server.CreateObject("ADODB.Recordset")
oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=nextbowluser.com; PORT=3306; DATABASE=xxxxx; USER=xxxx; PASSWORD=xxxxxxx; OPTION=3;"
Sql="select CoupPicVoid from coupbook"
oRecordset.Open Sql, oConnection,3,3
do until oRecordset.eof
Response.ContentType = "image/jpeg"
Response.BinaryWrite oRecordset("CoupPicVoid")
oRecordset.movenext
loop
oRecordset.Close
oConnection.Close
Set oRecordset = Nothing
Set oConnection = Nothing
%>
testpic.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<img src="pic.asp">
</body>
</html>
As you can tell, the <img src="pic.asp"> displays the image that the database is finding. But it only displays one pic. What can i do in order to display all the images that the query finds?
Thanks for your time,
David
Here is my current code:
Pic.asp page
<%
Dim oConnection
Dim oRecordset
Dim Sql
Response.Expires = -10
Response.Buffer = True
Response.Clear
Set oConnection = Server.CreateObject("ADODB.Connection")
Set oRecordset = Server.CreateObject("ADODB.Recordset")
oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=nextbowluser.com; PORT=3306; DATABASE=xxxxx; USER=xxxx; PASSWORD=xxxxxxx; OPTION=3;"
Sql="select CoupPicVoid from coupbook"
oRecordset.Open Sql, oConnection,3,3
do until oRecordset.eof
Response.ContentType = "image/jpeg"
Response.BinaryWrite oRecordset("CoupPicVoid")
oRecordset.movenext
loop
oRecordset.Close
oConnection.Close
Set oRecordset = Nothing
Set oConnection = Nothing
%>
testpic.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<img src="pic.asp">
</body>
</html>
As you can tell, the <img src="pic.asp"> displays the image that the database is finding. But it only displays one pic. What can i do in order to display all the images that the query finds?
Thanks for your time,
David