Ask a Question related to Informix, Design and Development.
-
William Fields #1
Setting the value of an Informix v7.3 BLOB field using ADO, VFP and OLEDB
Hi everyone,
I'm trying to replace an Informix v7.3 BLOB field in an existing record with
a .PDF file and it's giving me fits! I've adapted the KB article Q258038
([url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;258038[/url]) to work in
VFP, but I"m getting the error:
"OLE exception error: Exception code c0000005. OLE object may be corrupt"
When I execute the loRecordSet.UpdateBatch command.
I do know that the document on disk is OK, I can open it in Acrobat and it
looks fine. I've also tried using other .PDF's with the same results. I've
also tried the ADLOCKOPTIMISTIC/Update combo with the same results.
I'm not very well versed in ADO so I find myself googling all day hunting
for leads. Any expert knowledge would be appreciated. FYI - I've tried other
cursor types, but the others error out saying "Scroll cursor can't select
blob columns".
See below for my code.
======================================
#include "I:\COMMON\adovfp.h"
LOCAL lcConnStr, lcSQL, loConnection, lcImageName, ;
loRecordSet, loADOStream
lcConnStr = 'Provider=Ifxoledbc.2;' +;
'Password=Password;' + ;
'Persist Security Info=True;' +;
'User ID=UserID;' +;
'Data Source=MyDatabase@MyServer'
lcSQL = "SELECT dm_id, dm_seq, dm_doc FROM informix.document WHERE dm_id =
22280 AND dm_seq = 0"
*!* Creates the objects.
loConnection = CREATEOBJECT("ADODB.Connection")
loRecordSet = CREATEOBJECT("ADODB.Recordset")
loADOStream = CREATEOBJECT("ADODB.Stream")
*!* Open the connections.
loConnection.OPEN(lcConnStr)
loRecordSet.CursorLocation = adUseClient
loRecordSet.OPEN(lcSQL,loConnection,ADOPENFORWARDO NLY,ADLOCKBATCHOPTIMISTIC,
1)
*!* Set Stream Object properties.
loADOStream.TYPE = 1 && 1=Binary Data, 2=Text Data.
loADOStream.OPEN
loADOStream.LoadFromFile("I:\INFORMIX\inDocument.p df") && Pass data to the
stream object.
loRecordSet.Fields("dm_doc").Value = loADOStream.Read
loRecordSet.UpdateBatch
*!* Close connections.
loRecordSet.CLOSE
loConnection.CLOSE
loADOStream.CLOSE
======================================
Thanks.
--
William Fields
MCSD - Microsoft Visual FoxPro
MCP - Win2k Pro
US Bankruptcy Court
Phoenix, AZ
"While the complexity of this project is
several orders of magnitude less than
modeling heat flux in a fossil-fuel fired
electric utility plant using the Hottel Zone
technique, the context of each project
evolves in a remarkably similar fashion."
- Author Unknown
William Fields Guest
-
php and informix blob
I am running PHP 4.2.3 with Informix Dynamic Server 2000 Version 9.20.HC. I am trying to insert some text into a blob space and I get a -609 error.... -
#25510 [Opn->Fbk]: How to get Blob in informix
ID: 25510 Updated by: sniper@php.net Reported By: tqnam at pmail dot vnn dot vn -Status: Open +Status: ... -
#25510 [Fbk->Opn]: How to get Blob in informix
ID: 25510 User updated by: tqnam at pmail dot vnn dot vn Reported By: tqnam at pmail dot vnn dot vn -Status: ... -
#25510 [NEW]: How to get Blob in informix
From: tqnam at pmail dot vnn dot vn Operating system: window 2000 PHP version: 4.3.3 PHP Bug Type: Informix related Bug... -
IBM Informix OLEDB driver bug
My code sum a database column whose type is 4 bytes integer Select SUM(col1) From tbl GROUP BY col2 ORDER BY col3 The SUM value can be up to 7...



Reply With Quote

