从Access数据库恢复BMP图像并显示在WEB页面(microsoft)

2016-01-29 17:57 18 1 收藏

从Access数据库恢复BMP图像并显示在WEB页面(microsoft),从Access数据库恢复BMP图像并显示在WEB页面(microsoft)

【 tulaoshi.com - ASP 】

  HOWTO: Retrieving Bitmap from Access and Displaying In Web Page

--------------------------------------------------------------------------------
The information in this article applies to:

Active Server Pages
Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
ActiveX Data Objects (ADO), versions 1.0, 1.5, 2.0, 2.1 SP2, 2.5
Microsoft Internet Information Server versions 4.0, 5.0
Microsoft Data Access Components version 2.5

--------------------------------------------------------------------------------


SUMMARY
This article shows by example how to extract the bitmap photos in the Microsoft Access 97 Northwind.mdb
database, and view them from a Web browser using Active Server Pages (ASP). In order to accomplish this
task, an ActiveX DLL must be created that strips the Access and OLE headers from the field. This article
shows how to create this ActiveX DLL, and how to implement it.



MORE INFORMATION
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this
code "as is" without warranty of any kind, either express or implied, including but not limited to the
implied warranties of merchantability and/or fitness for a particular purpose.

This article demonstrates how to use Visual Basic to retrieve a bitmap stored in an OLE Object field.
Because the definition of OLE object storage is not documented, the following code searches the object's
OLE header for characters consistent with the start of the graphic. This method may not work in all
circumstances.

Be aware that Internet Explorer 3.0 is unable to display true color bitmaps. For this reason, the bitmaps
stored in the Access database should be no higher than 256 colors.

Step-by-Step Example to Extract the Photos
Create a new project in Visual Basic and make the project an ActiveX DLL.


Add a reference to ActiveX Data Objects (ADO) by clicking the Project menu and selecting References.
Select "Microsoft OLE DB ActiveX Data Objects 1.0 Library" and click OK.


Add a new module to the project by selecting the Project menu and clicking Add Module. Select Module and
click Open.


Place the following code in the (general) (declarations) section of MODULE1.BAS:

      ' Enter the following Declare statement as one single line:
      Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
       (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

      Type PT
        Width As Integer
        Height As Integer
      End Type

      Type OBJECTHEADER
        Signature As Integer
        HeaderSize As Integer
        ObjectType As Long
        NameLen As Integer
        ClassLen As Integer
        NameOffset As Integer
        ClassOFfset As Integer
        ObjectSize As PT
        OleInfo As String * 256
      End Type



Place the following code in the (general) (declarations) section of CLASS1.CLS:

        Function DisplayBitmap(ByVal OleField As Variant)
        Dim Arr() As Byte
        Dim ObjHeader As OBJECTH

来源:https://www.tulaoshi.com/n/20160129/1503666.html

延伸阅读
大家都知道,数据库的安全性是很重要的,它直接影响到数据库的广泛应用。用户可以采用任意一种方法来保护数据库应用程序,也可以将几种方法结合起来使用。利用Access数据库自身提供的加密功能及其他保护方法是很容易的,我就不多说了。在Access数据库中,嵌入了一种很强的数据库操作语言——Visual Basic语言,所以可以采用Visual Basic编写程...
用Authorware开发多媒体作品,自然不能少了图片的显示。通常我们是用框架图标,把要显示的图片依次导入。这样做非常麻烦,每一幅图片要依次导入,逐个设置显示方式,这且不说,万一下次要显示不同的图片时,还得重新导入、设置,非常烦琐。那么,能不能让Authorware显示指定文件夹里的图片呢?这样,就用不着每次都要导入了,只要指定图片所在...
在C++ Builder中使用Access数据库既可以在设计期实现,也可以在运行期通过编程实现。下面就以一个简单的例子,来说明在C++ Builder中如何使用Access数据库。 在设计期使用Access数据库 首先新建一个工程,保存单元文件为Unit1.cpp,保存工程文件为Project1.bpr。假设保存工程文件的路径下已有一个Access数据库文件student.mdb,...
一般在Oracle中使用Sql,在Access中使用很少,不过与Oracle的Sql还是有很多相似之处的。 以下SQL语句在ACCESS XP的查询中测试通过 建表: Create Table Tab1 (     ID Counter primary key,     Name string(20),     Age integer,     [Date] DateTime); 技巧: 自动增加...
标签: ASP
在基于微软IIS/PWS的网络平台上,通过服务器端运行的ASP程序来访问后台数据库,是一种最常见的模式了。而对于小型的数据库应用需求,微软的Access数据库,应该是与ASP程序配套使用的首选。由于Access数据库的ODBC驱动程序支持的SQL指令全,执行效率高,所以Access后台数据库+ASP服务器端程序+客户端IE浏览器,是一个精练实用高效的组合模式...

经验教程

883

收藏

54
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部