如何使用Vb.Net中的Oledb驱动程序从Oracle客户端检索BLOB数据? [英] How to retrieve BLOB data from Oracle Client using Oledb driver in Vb.Net?

查看:121
本文介绍了如何使用Vb.Net中的Oledb驱动程序从Oracle客户端检索BLOB数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我正在使用oleDbConnection以便从Oracle列中选择BLOB数据,并且由于我的所有应用程序都在使用它,因此我必须坚持使用这种类型的连接.

使用以下代码后,出现错误: 未指定错误 ..


Greetings,

I`m using oleDbConnection in order to Select a BLOB data from Oracle column, and I have to stick with this type of connection since all my application is using it.

After I used the following code, I got the error: unspecified error..


Dim pSelectCommand As OleDbCommand = New OleDbCommand() 
Dim commandTextTemplate As String = "SELECT PICTURE FROM ALBUMS WHERE CODE= 4"
pSelectCommand.CommandText = commandTextTemplate
pSelectCommand.Connection = g_pOleDbConnection 

Dim fs As FileStream 

' Open the connection and read data into the DataReader.
If g_pOleDbConnection.State = ConnectionState.Closed Then g_pOleDbConnection.Open()

Dim myReader As OleDbDataReader = pSelectCommand.ExecuteReader() 'Error is on this line

Do While (myReader.Read())
Dim byteArray As Byte() = (myReader(g_pfldAPicture))
fs = New FileStream("Album.bmp", FileMode.CreateNew, FileAccess.Write)
fs.Write(byteArray, 0, byteArray.Length)
Loop




请告知..
谢谢...




Please advise..
Thank you...

推荐答案

Oracle Blob不是由OleDb支持. [ ^ ].
您必须使用ADO.net.
Oracle Blobs are not supported[^] by OleDb.
You have to use ADO.net instead.


请参考以下线程,您一定会从中得到帮助:

读取BLOB数据并将其写入Microsoft SQL或Oracle数据库 [使用C#在Oracle中插入CLOB数据 [ ^ ]
将图像插入Blob中/从Blob中检索图像使用C#.Net [
Please refer following threads, You will surely get some help from them:

Reading and Writing BLOB Data to Microsoft SQL or Oracle Database[^]
Using C# for Inserting CLOB Data in Oracle[^]
Insert /retrieve an image into/ from a blob field in Oracle database using C#.Net[^]


这篇关于如何使用Vb.Net中的Oledb驱动程序从Oracle客户端检索BLOB数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆