如何把数据库中的二进制图像读出来并存成对应各式的图片文件?

rt
---------------------------------------------------------------

dim st
while not rs.eof
set st = Server.CreateObject("adodb.stream")
st.Type = 1
st.Open
st.Write(rs("img"))
st.SaveToFile "C:"&rs("id")&".gif",2
st.close
rs.movenext
wend
---------------------------------------------------------------

set rs5=server.CreateObject("adodb.recordset")
sql5="select * from t_info where c_username='"&id&"'"
rs5.open sql5,conn,3,1
response.ContentType="image/*"
response.BinaryWrite rs5("你的字段")
rs5.close
set rs5=nothing
conn.close
set conn=nothing

Published At
Categories with Web编程
Tagged with
comments powered by Disqus