🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #497

TADOCommand and Blob

#497
From: Foo Tze Wan
Date: Tue, 23 Aug 2005 09:33
55 lines
2774 bytes
Hi,

I am using BCB6 to read and write data to Interbase. The ODBC driver used is 
from Easysoft (trial version). I have tried to write to the table.

Without the Blob field (BLOB_FIELD), it works fine. But when I include the 
Blob field, an EOleException - "Type is Invalid" is raised upon Execute( ).

Wonder if anyone has any clue on what could be wrong ( I suspect is the 
driver, but cannot confirm).

The following is a snippet of my code.

{
            TMemoryStream *mem_stream_ptr;
            AnsiString    sql_command_string;

            mem_stream_ptr = new TMemoryStream();

            sql_command_string = AnsiString("INSERT INTO USER_TABLE (USERID, 
DEPARTMENT, BLOB_FIELD) ") +
                                         "VALUES (:pUserID, :pDepartment, 
:pBlobField)";

            ADOCommandUser->CommandText = sql_command_string;

            ADOCommandUser->Parameters->ParamByName("pUserID")->DataType = 
ftString;
            ADOCommandUser->Parameters->ParamByName("pDepartment")->DataType 
= ftString;
            ADOCommandUser->Parameters->ParamByName("pBlobField")->DataType 
= ftBlob;

            ADOCommandUser->Parameters->ParamByName("pUserID")->Value = 
"1234";
            ADOCommandUser->Parameters->ParamByName("pDepartment")->Value = 
"Finance";

            mem_stream_ptr->WriteBuffer(BlobFieldArray, 4856); // The size 
of the blob field is as such.

            // BlobFieldArray is a global, declared as --> unsigned char 
BlobFieldArray[5000];

            mem_stream_ptr->Position = 0;
            mem_stream_ptr->Seek(0, soFromBeginning);
            ADOCommandFPUser->Parameters->ParamByName("pFP")->LoadFromStream(mem_stream_ptr, 
ftBlob);
            ADOCommandFPUser->Execute();
}

Appreciate any help.

Thanks and regards,
Tze Wan 
Technical Details
Message-ID: <430aed68@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,221d9548c2024384,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Foo Tze Wan" <twfoo@nospam.com>
From: "Foo Tze Wan" <twfoo@nospam.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: TADOCommand and Blob
Date: Tue, 23 Aug 2005 17:33:31 +0800
Lines: 57
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 210.24.189.100
Message-ID: <430aed68@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1124789608 210.24.189.100 (23 Aug 2005 02:33:28 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail