用ASP显示ACCESS数据库的GIF图象
时间:2008-11-16 18:09:00
写入:
1:把gif图像文件读入内存(一个变量strTemp)。
2:写入数据库。
Dim binTmp() As Byte
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open "db"
strSql = "select * from tbImage"
rs.Open strSql, conn, 1, 3
OpenFile ("bayshore.jpg")
'请自己实现OpenFile函数
rs.AddNew
rs.Fields("image").AppendChunk binTmp
rs.Update
读出和显示:
show.asp:
<%
dim P
dim L
L = 8192
dim conn,rs,strSql
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &server.MapPath(".") & "db2.mdb;Persist Security Info=False"
set rs=server.CreateObject("ADODB.Recordset")
strSql = "select * from tbImage"
Response.ContentType = "image/gif"
'Important!
rs.open strSql,conn,1,1
rs.movelast
do
P = rs("image").GetChunk(L)
Response.BinaryWrite P
IF LenB(P) < L then exit do
loop
%>
在html中:
<image src=show.asp>
标签:图片,gif,ADODB,数据库
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
vue项目持久化存储数据的实现代码
2024-04-27 15:59:48
python标准库os库的函数介绍
2022-02-26 09:57:15
SQL Server命令行导数据的2种方式
2010-07-26 14:48:00
Python matplotlib绘图设置图例案例
2021-08-17 07:05:04
![](https://img.aspxhome.com/file/2023/4/110214_0s.png)
python计算机视觉OpenCV库实现实时摄像头人脸检测示例
2022-05-17 22:41:50
![](https://img.aspxhome.com/file/2023/5/105305_0s.png)
修复 jQuery 中 isFunction 方法的 BUG
2010-01-25 12:05:00
解决缩小图标变样问题
2007-10-08 19:13:00
![](https://img.aspxhome.com/file/UploadPic/200710/8/2007108191659246s.png)
Golang Gin局部和全局中间件使用详解
2023-07-10 03:03:00
![](https://img.aspxhome.com/file/2023/7/86297_0s.jpg)
Python模块搜索路径代码详解
2021-07-11 10:37:17
python 找出list中最大或者最小几个数的索引方法
2022-08-12 13:23:11
asp利用aspjpeg给图片生成PNG透明水印
2009-03-20 14:01:00
webpack cjs运行时分析示例详解
2024-04-19 09:51:56
![](https://img.aspxhome.com/file/2023/2/136072_0s.jpg)
python selenium爬取斗鱼所有直播房间信息过程详解
2023-11-19 07:00:11
使用python远程操作linux过程解析
2021-12-01 21:05:27
Python 异常处理实例详解
2021-10-14 05:36:39
pytorch学习教程之自定义数据集
2021-06-09 03:13:16
![](https://img.aspxhome.com/file/2023/6/117396_0s.png)
5款实用的python 工具推荐
2021-08-09 20:13:28
![](https://img.aspxhome.com/file/2023/1/81721_0s.gif)
python使用matplotlib画柱状图、散点图
2023-05-18 11:50:06
![](https://img.aspxhome.com/file/2023/7/123797_0s.png)
256种编程语言大汇总
2023-05-30 19:06:01
Python个人博客程序开发实例用户验证功能
2023-07-31 14:24:36
![](https://img.aspxhome.com/file/2023/2/61192_0s.png)