读数据库图片存为文件

来源:互联网 发布:便携式热点软件 编辑:程序博客网 时间:2024/06/11 07:34
<!--#include file="conn.asp" -->
<%
set rs=conn.execute("select * from youtable")
  Set oFileStream = CreateObject ("ADODB.Stream")
  oFileStream.Type = 1
set id=rs("id")
set photo=rs("photo")
do while rs.eof=false
 oFileStream.Open
 oFileStream.Write photo.value
 oFileStream.SaveToFile "d:/photo"& id &".jpg",2
 oFileStream.close
 rs.movenext
loop
set  oFileStream=nothing
set photo=nothing
set id=nothing
rs.close
set rs=nothing
call closedatabase()
%>