🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Please Help - Retrieveing Image from Database with ADO

#2094
From: Mike Crapo
Date: Tue, 04 Nov 2003 15:09
43 lines
2138 bytes
Hello.

I have this code that I have written for retrieving a graphic from the
database.

//Connected to database
TADOQuery *Query = new TADOQuery(0);
TADOBlobStream *Stream;
Query->SQL->Add("SELECT Image FROM tbImage WHERE ImgID = 31");
Query->Connection = ADOConnection;
Query->CursorType = ctStatic;
Query->CacheSize = 10000;
Query->CursorLocation = clUseClient;
Query->LockType = ltReadOnly;
Query->Open();
if(Query->RecordCount > 0)
  {
  Query->First();
  TADOBlobStream((TBlobField*)Query->Fields->Fields[0],bmRead);
  Stream->Position = 0;
  //Work with graphic
  delete Stream;
   }
delete Query;
//DisConnect database

The database is Access using the 2002 format.

I have this code work ok in one project, but when I copy and pasted it
into another project it does not work.  

Here is the wierd part.  In the project when the code works, if you
look at the Stream->Size it is equal to 541881.  In the project where
it does not work if you look at the same size it is alway equal to 4.

Also if I load borlands service pack 4 the code in the application
that did work, quits working, it now only returns a Stream->Size = 4.


Can anyone tell me what I am doing wrong, and how to fix it please.

Thank You Very Much.
Michael Crapo
Technical Details
Message-ID: <htffqv8671rgj79ss1ak1rhqfgsgkr4mk0@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,a072fa01fe6a770e,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-11-04 07:33:05 PST
From: Mike Crapo <>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Please Help - Retrieveing Image from Database with ADO
Date: Tue, 04 Nov 2003 09:09:06 -0600
Message-ID: <htffqv8671rgj79ss1ak1rhqfgsgkr4mk0@4ax.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.178.101.226
X-Trace: newsgroups.borland.com 1067958747 208.178.101.226 (4 Nov 2003 07:12:27 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail