Solved

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

Posted on 2009-04-07
4
1,035 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 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