Article View: borland.public.cppbuilder.database.ado
Article #499Re: TADOCommand and Blob
From: Viatcheslav V. Vassiliev
Date: Tue, 23 Aug 2005 18:44
Date: Tue, 23 Aug 2005 18:44
79 lines
3658 bytes
3658 bytes
There are few native OLEDB providers for Interbase such as one from
http://www.ibprovider.com, or google for "Interbase OLEDB". OLEDB provider
for ODBC is deprecated, and native OLEDB providers are usually better work
and have less problems.
You may also try to set type to something like ftVarBytes.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Foo Tze Wan" <twfoo@nospam.com> �������/�������� � �������� ���������:
news:430aed68@newsgroups.borland.com...
> 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:
<430b6e86$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!border1.nntp.dca.giganews.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<430aed68@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,221d9548c2024384 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <430aed68@newsgroups.borland.com> Subject: Re: TADOCommand and Blob Date: Tue, 23 Aug 2005 22:44:50 +0400 Lines: 81 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <430b6e86$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1124822662 85.93.138.132 (23 Aug 2005 11:44:22 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!border1.nntp.dca.giganews.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail