Solved

How to delete (remove picture) blob from a Firebird 2.0 blobfield using clientdataset.

Posted on 2009-04-07
4
1,019 Views
Last Modified: 2012-05-06
I'd like to know how to remove picture from a blob field.

I tried to create an empty memory stream and copy that to clientdatasets blob field.

That removed picture cds but after applyupdates the picture got back (never went away).

Pekka
procedure TEtusivu.IWButton1Click(Sender: TObject);
var
   strBlob, strTmp: TStream;
begin
  try
   cdsBlobtest.Edit;
   strBlob := cdsBlobtest.CreateBlobStream(cdsBlobtest.FieldByName('Image'), bmWrite);
   strTmp := TMemoryStream.Create;
   strBlob.CopyFrom(strTmp,0);
   cdsBlobtest.Post;
   cdsBlobtest.ApplyUpdates(0);
  finally
    strBlob.Free;
    strTmpfree; 
  end;
 
end;

Open in new window

0
Comment
Question by:ppaunio
4 Comments
 
LVL 1

Accepted Solution

by:
chunky1 earned 125 total points
ID: 24085943
Hi,
I have never tried this but how about editing the record and assigning Null to the field something like:

cdsBlobtest.Edit
cdsblobtest.fieldvalues['Image']:=null;
cdsblobset.post;

Might be worht a try.

Paul.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24086113
or use a sql statement in a query

UPDATE TABLE SET FIELD = NULL WHERE ID = 1
0
 
LVL 18

Expert Comment

by:Johnjces
ID: 24087627
Try also..

cdsBlobtest.FieldByName('Image').asVariant := '';

Have edit above and post below of course. This does work for me.

John
0
 

Author Closing Comment

by:ppaunio
ID: 31567441
Yes this worked. Have to remember to put 'Variants' in the uses section.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question