Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress BLOB image with ADO

Status
Not open for further replies.

marvel62

Programmer
Aug 14, 2003
1
ZA
Hi all,

i am trying to write/read an image to/from Progress through ADO 2.6 using VB. The code im using works fine into Microsoft SQL 2000.

Ill only post the writing code and error message (i think if i can get that to work, the reading should also work)

This is the error message im getting:
"Multi-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done."

and if i change the cursor type to Client it returns this error:
"Multi-step OLE DB operation generated errors. Check each OLE DB
status value."

CODE:

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim stm As ADODB.stream
Dim lSize As Long
Dim x As Long
Dim y As Long

Set stm = New ADODB.stream

cn.ConnectionString = " DSN=podimg;UID=ODBC;PWD=;HOST=brsales;PORT=podimg;
DB=podimg;"
cn.Open

''i have tried selecting specific columns instead of using *
rs.Open "Select * from pub.PODIMAGE Where 1=2", cn, adOpenKeyset, adLockOptimistic

'Read the binary files from disk.
stm.Type = adTypeBinary
stm.Open
stm.LoadFromFile "c:\Image.tif"

lSize = GetFileSize("c:\Image.tif")
y = 1
For x = 0 To lSize Step 16000
rs.AddNew
rs!INVOICENO = "IP123456"
rs!IMAGENUM = 1
rs!CHUNKNO = y
''Progress can only handle 16k blocks - rounded for ease of use
If Abs(lSize - x) < 16000 Then
rs!IMAGEDATA = stm.Read(Abs(lSize - x)) ''AT THIS POINT I RECIEVE THE ERROR
Else
rs!IMAGEDATA = stm.Read(16000) ''AT THIS POINT I RECIEVE THE ERROR
End If
''Insert the binary object into the table.
rs.Update
y = y + 1
Next x

rs.Close
stm.Close

Set rs = Nothing
Set stm = Nothing

/CODE:

ps. I have edited my code for this forum. I only want to show the relevant code. I have tested my code on Microsoft SQL 2000 and it works fine.

Your help would be GREATLY appreciated.
i Have been struggling for a week and we need to go into user testing soon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top