Solved

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

Posted on 2009-04-07
4
1,009 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 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