批量读图片到数据库

类别:软件工程 点击:0 评论:0 推荐:
<!--#include file="conn.asp" -->
<%
'假设图片路径为path="d:/photo/"
set rs=conn.execute("select id from youtable")
set ads=CreateObject("Adodb.Stream")
Set rs2=Server.CreateObject("Adodb.RecordSet")
ads.Mode=3
ads.Type=1
set id=rs("id")
do while rs.eof=false
 ads.Open
 ads.LoadFromFile(path & id &".jpg")
 rs2.Open "select * from youtable where id=" & id,conn,1,3
 rs2.addnew
 rs2("photo")=ads.read()
 rs2.update
 rs2.close
 ads.close
 rs.movenext
loop
set id=nothing
set rs2=nothing
set ads=nothing
set rs=nothing
%>

本文地址:http://com.8s8s.com/it/it33526.htm