Subject Re: [IBO] Blob-Error
Author Luiz
Using IBO Dataset comp, I use something as:

1.To Read
var st:TMemoryStream;
begin
st:=TMemoryStream.Create;
try
TblobField(qr_Histo.fieldbyname('Fatura')).SaveToStream(st);
LFaturasFinal.Items.LoadFromStream(st);
finally
st.Free;
end
end;

2.To Write
var st:TMemoryStream;
begin
st:=TMemoryStream.Create;
try
qr_Histo.Edit;
LFaturasFinal.Items.SaveToStream(st);
TblobField(qr_Histo.fieldbyname('Fatura')).LoadFromStream(st);
qr_Histo.Post;
finally
st.Free;
end
end;


Using IBO native comp:
1: To Read
var tb:Tstream;
PICTField:TIB_ColumnBlob;
begin
PICTField:= TIB_ColumnBlob( TIB_Query(Sender).FieldByName( 'FOTO' ));
tb:=qr_clientes.CreateBlobStream(PICTField,bsmread);
try
FotoCli.LoadFromStream(tb);
finally
tb.free;
end;
end;

2. To Write:
var BlobStream:TStream;
with FotoCli do begin
BlobStream:=qr_clientes.CreateBlobStream(PictField,bsmWrite);
try
SaveToStreamJpeg(BlobStream);
finally
BlobStream.free;
end;
end;

All are working well to me.
If this not works to you, maybe you have a database problem.

hth,
Luiz.

----- Original Message -----
From: "Gerhard Knapp" <prometheus@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, January 29, 2002 9:43 AM
Subject: Re: [IBO] Blob-Error


> hi helen and list,
> mhm it doesn't work ..
> if i take a TBMemo standard component and in the properties i add a
standard-Datasource for IBOQuery (a TDatasource) then
> i can read and write the field mail in the dbmemo, so i think, if the
component can it, it will be possible also with
> blobstream or TIB_Blobstream, mhm.
>
> my tryings with with blobstream or TIB_Blobstream have no postive result,
> no errormessage comes, but the memo is allways empty ...
> ...
> dmx.q_mail.InternalDataset.Fields['MAIL'] -> doesn't work, comes: Word -
String conflict,
> in this case i have to know the field-#, ...fields[3] or so ..
> but
> dmx.q_mail.Internaldataset.fieldbyname('mail') works ... as you thought ..
> ...
> my problem of TBMemo or Memo i can solve, but the principle possibility,
> to save anything in a Blob-field (pictures, word-documents, htmlpages,
sounds, etc.) and
> get it back is not solved ...(can only realize with blobstreams)...
> i use blob-fields for this all in my modules ..
>
> your help let me go a step further, but i have to learn a lot of IBO ....
>
> perhaps you see anything or have an idea about this ....
>
> thank you and best regards
> - gerhard