不使用组件实现多个图片与文本数据同时写入数据库(4)

发表于:2007-06-30来源:作者:点击数: 标签:
显示图片的程序: ‘’filename:showpic.asp ‘’-------------------- % response.expires=0 response.buffer=true response.clear set conn=server.CreateObject(ADODB.Connection) conn.Open driver={ SQL Server};server=ServerIP;uid=UserName;pwd=PassW
显示图片的程序:
‘’filename:showpic.asp
‘’--------------------
<%
response.expires=0
response.buffer=true
response.clear
set conn=server.CreateObject("ADODB.Connection")
     conn.Open "driver={SQL
Server};server=ServerIP;uid=UserName;pwd=PassWord;database=DataBaseName"

set rec=server.createobject("ADODB.recordset")

strsql="select img1 from xl where ID=" & request("id")
‘’img1/img2是存放图片的字段,用同样的方法可以显示img2里的图像
rec.open strsql,conn,1,3

Response.ContentType = "image/*"

Response.BinaryWrite rec("img1").getChunk(7500000)

rec.close

set rec=nothing

conn.close

set connGraph=nothing

%>

原文转自:http://www.ltesting.net