Problem with Oracle BLOB field in VB
Hi,
I have a VB 6.0 application with a backend Oracle 8i Database.
A piece of code in this application is throwing me an error:
Err.Number = -2147467259
Err.Description = Data Type is not supported.
I must mention the following:
1) I am using Microsoft ActiveX Data Objects 2.6 Library
2) The DB has a table named MyPicTable with the following structure:
Code:
Create Table MyPicTable
(
Pic_ID NUMBER(10)
, Pic_Image BLOB
)
3) I am using MSDORA as connection Provider as follows:
(I must mention that I am getting a connection to the DB! That's OK! Also, using this connection string is a compulsion!!)
VB Code:
' ************************************************** *********
' serverName, dbUID, dbPWD are variables defined elsewhere
' serverName will be in the format 127.0.0.1
ConnectStr = "Provider=MSDAORA;Server=" & serverName & ";User ID=" & dbUID & ";Password=" & dbPWD & ";"
Set myConn = New ADODB.Connection
With myConn
.ConnectionString = ConnectStr
.CursorLocation = adUseClient
.Open
End With
' ************************************************** *********
Dim myRS As New ADODB.Recordset
Dim strSelectSQL As String
Set myRS = New ADODB.Recordset
strSelectSQL = "SELECT * FROM MyPicTable WHERE 1=2"
' This line of code causes the error
' Err.Number = -2147467259
' Err.Description = Data Type is not supported.
myRS.Open strSelectSQL, myConn, adOpenForwardOnly, adLockOptimistic
Could anyone kindly throw some light as to why the application is throwing this error...
Thanks in advance,
Nilanjan. :cry:
Re: Problem with Oracle BLOB field in VB
In Oracle 8.1 to store image you need to create a field of LongRAW type (I don't have Oracle handy at the moment but I think that's the right field type, though).
Re: Problem with Oracle BLOB field in VB
Quote:
Originally Posted by RhinoBull
In Oracle 8.1 to store image you need to create a field of LongRAW type (I don't have Oracle handy at the moment but I think that's the right field type, though).
Hi RhinoBull,
Thanks for the reply!
Creating the table with the BLOB field doesn't seem to be the problem because the table gets created from SQL * Plus without any hitch whatsoever. The error arises when I try to issue a SELECT statement from within VB. Can it be something related to connection string??
Thanks in advance.
Nilanjan. :ehh:
Re: Problem with Oracle BLOB field in VB
ADO doesn't recognize Oracle's BLOB - use LongRAW instead. I had this issue some time ago.
Regards.
Re: Problem with Oracle BLOB field in VB
Quote:
Originally Posted by RhinoBull
ADO doesn't recognize Oracle's BLOB - use LongRAW instead. I had this issue some time ago.
Regards.
Thanks a lot for your help RhinoBull. Have changed the field to LONG RAW & it works...Cheers..! :)
Re: Problem with Oracle BLOB field in VB
Quote:
Originally Posted by nilug_123
... Have changed the field to LONG RAW & it works...Cheers..! :)
I knew it would ... :thumb: