Solved

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

Posted on 2009-04-07
4
994 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 36

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now