VB6 Oracle将Clob检索到数组中 [英] VB6 Oracle Retrieving Clob into an array

查看:94
本文介绍了VB6 Oracle将Clob检索到数组中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据类型为clob的oracle字段检索到VB数组中,而不重新构造检索SQL字符串(只需SELECT * FROM my_table).我正在使用ADO记录集.

I am trying to retrieve an oracle field with datatype clob into a VB array without reformating the retrieval SQL string (simply SELECT * FROM my_table). I am using an ADO recordset.

当我关闭连接或对记录集执行任何其他操作时,clob值会丢失.我该如何做到这一点.

The clob values are lost when I close the connection or do any other action with the recordset. How can I achieve this.

推荐答案

在我的一个项目中,我尝试使用ADO操作BLOB和CLOB,但没有成功,直到我切换到

In one of my projects I tried to manipulate BLOBs and CLOBs using ADO, but without any success, until I switched to Oracle Objects 4 OLE. You need to install and configure Oracle client on your machine, the in project references add "Oracle InProc Server 4.0 Type Library".

这是我用于BLOB的示例代码:

Here's a sample code I used for BLOBs:

Dim OraSession  As OracleInProcServer.OraSessionClass
Dim OraDatabase As OracleInProcServer.OraDatabase
Dim OraDynaset  As OracleInProcServer.OraDynaset
Dim srcImg As OraBlob

Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase("myDBName", "login/password", 0&)

Set OraDynaset = OraDatabase.DbCreateDynaset("SELECT src_id, src_image from Sources where src_file_name like '%.png'", 0&)
With OraDynaset
    If .RecordCount > 0 Then
        .MoveFirst
        While (Not .EOF Or .BOF)
            Set srcImg = .Fields("src_image").Value
            srcImg.CopyToFile ("C:\sources\" & srcID & ".png")
            .MoveNext
        Wend

    End If
End With

Set OraDynaset = Nothing
Set OraDatabase = Nothing
Set OraSession = Nothing

这篇关于VB6 Oracle将Clob检索到数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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