'模块代码
Private Declare Function CreateStreamOnHGlobal Lib "ole32" (ByVal hGlobal As Long, ByVal fDeleteOnRelease As Long, ppstm As Any) As Long
Private Declare Function OleLoadPicture Lib "olepro32" (pStream As Any, ByVal lSize As Long, ByVal fRunmode As Long, riid As Any, ppvObj As Any) As Long
Private Declare Function CLSIDFromString Lib "ole32" (ByVal lpsz As Any, pclsid As Any) As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal uFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal dwLength As Long)
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long Public Type GUID ' 16 bytes (128 bits)
'dwData1 As Long ' 4 bytes
'wData2 As Integer ' 2 bytes
'wData3 As Integer ' 2 bytes
abData4() As Byte ' 8 bytes, zero based
End Type Public Function PictureFromByteStream(B() As Byte) As IPicture
Dim hMem As Long
Dim lpMem As Long
Dim LowerBound As Long
Dim ByteCount As Long
Dim IID_IPicture As GUID
Dim istm As stdole.IUnknown LowerBound = LBound(B)
ByteCount = UBound(B) - LowerBound + hMem = GlobalAlloc(&H2, ByteCount) If hMem <> Then lpMem = GlobalLock(hMem) If lpMem <> Then MoveMemory ByVal lpMem, B(LowerBound), ByteCount GlobalUnlock hMem If CreateStreamOnHGlobal(hMem, , istm) = Then If CLSIDFromString(StrPtr("{7BF80980-BF32-101A-8BBB-00AA00300CAB}"), IID_IPicture) = Then OleLoadPicture ByVal ObjPtr(istm), ByteCount, , IID_IPicture, PictureFromByteStream End If End If End If End If End Function
Public Sub Combo1_Click() Dim adoCnn As ADODB.Connection
Dim rstOra As ADODB.Recordset
Dim intI As Integer Set adoCnn = New ADODB.Connection
Set rstOra = New ADODB.Recordset adoCnn.ConnectionString = "Provider=OraOLEDB.Oracle;User ID=dzjc;password=zlkj;Data Source=dzjc_2005;" '读blob字段要用Provider=OraOLEDB.Oracle adoCnn.CursorLocation = adUseClient
adoCnn.Open rstOra.CursorLocation = adUseClient rstOra.ActiveConnection = adoCnn
rstOra.Open "SELECT zp FROM dzjc.dzjc_wfzp WHERE xh = '5'" 'Set Image1.DataSource = rstOra Set Image1.Picture = PictureFromByteStream(rstOra.Fields("zp").Value) End Sub
(转载)VB 查询Oracle中blob类型字段,并且把blob中的图片以流的方式显示在Image上的更多相关文章
-
SQL Server中TEXT类型字段值在数据库中追加字符串方法
在数据上我们往往会遇到ntext大文本类型,这种类型如果和 nvarchar类型相加会出现问题,所以有一中方法可以解决这种问题. 使用的sql 函数: TEXTPTR:返回要更新的 text.nt ...
-
Oracle中,如何将String插入到BLOB类型字段
1,String插入到BLOB类型字段,(这里的字符串以生成的XML为例): String XML = document.asXML(); //使用dom4j写成的xml是String类型,记得st ...
-
mybatis oracle BLOB类型字段保存与读取
一.BLOB字段 BLOB是指二进制大对象也就是英文Binary Large Object的所写,而CLOB是指大字符对象也就是英文Character Large Object的所写.其中BLOB是用 ...
-
Spring JDBC处理BLOB类型字段
以下示例将演示使用spring jdbc更新BLOB类型的字段值,即更新student表中的可用记录. student表的结构如下 - CREATE TABLE student( ID INT NOT ...
-
Java更新Oracle的clob类型字段
Java更新Oracle的clob类型字段 1.查询该clob字段 2.处理该clob字段查询结果 3.更新该clob字段查询结果 1.查询该clob字段 <select id="se ...
-
ORACLE插入DATE类型字段
1 怎样在ORACLE中输入DATE类型的字段 insert into table_name (date_column) values(to_date('2006-06-04','yyyy-mm-dd ...
-
【JDBC核心】操作 BLOB 类型字段
操作 BLOB 类型字段 MySQL BLOB 类型 MySQL 中,BLOB 是一个二进制大型对象,是一个可以存储大量数据的容器,它能容纳不同大小的数据. 插入 BLOB 类型的数据必须使用 Pre ...
-
C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法
原文:C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法 本人新手,在.Net中写WebAPI的时候,当接口返回的json数据含有日期时间类型的字段时, ...
-
oracle中如何判断blob类型字段是否为空
eg.假如有表T_GA_GRJBXX ,字段zp是blob类型 查询blob非空的记录 SELECT * FROM u_rs_sjgx.T_GA_GRJBXX TB WHERE TB.zp IS n ...
随机推荐
-
TCP connect的错误返回值
如果是TCP套接字,调用connect函数将激发TCP三次握手过程,而且仅在连接建立成功或出错时返回,其中错误返回可能有下面几种情况: (1)若TCP客户没有收到SYN分节的响应,则返回ETIMEDO ...
-
Gradle笔记系列(一)
1.Gradle概述 Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化构建工具.它使用一种基于Groovy的特定领域语言(DSL)来声明项目设置,抛弃了基于XML的 ...
-
Bypass pattern lock on Sony Xperia Z2 and backup all data
Yesterday she came to me with a Sony Xperia Z2 D6503. Guess what? She forgot the pattern so she coul ...
-
linux下源码安装apache服务
1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...
-
CF 552C 进制转换
http://codeforces.com/problemset/problem/552/C C. Vanya and Scales time limit per test 1 second memo ...
-
A + B Again 2057 有符号的64进位的运算
Problem Description There must be many A + B problems in our HDOJ , now a new one is coming.Give you ...
-
通过qsort(void * lineptr[], int left, int rifht, int (*comp)(void *, void *))解读指针函数和void指针
原函数是<The C programint language >5.11文本行排序的程序,如下: void qsort(void *v[], int left, int right, i ...
-
【JAVASCRIPT】ECMAScrip (转)
部分ECMAScript术语 ECMAScript Sun(现在的Oracle)公司持有着"Java"和"JavaScript"的商标.这就让微软不得不把自己的 ...
-
C#设计模式(13)——代理模式(Proxy Pattern)(转)
一.引言 在软件开发过程中,有些对象有时候会由于网络或其他的障碍,以至于不能够或者不能直接访问到这些对象,如果直接访问对象给系统带来不必要的复杂性,这时候可以在客户端和目标对象之间增加一层中间层,让代 ...
-
JQuery官方学习资料(译):避免与其他库的冲突
避免与其他库的冲突 JQuery库和它所有的插件都是包含在jQuery命名空间下的,作为一般规则,全局对象被存储在jQuery的命名空间内,所以你不会得到jQuery和任何其他库之间的冲突(例 ...