Article View: comp.lang.pascal.delphi.databases
Article #56Saving TTreeView in a Database using TBlobStream
From: Michael Huth
Date: Wed, 07 Apr 1999 00:00
Date: Wed, 07 Apr 1999 00:00
69 lines
3170 bytes
3170 bytes
Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------7D5FAD9DA3823A084A3C6AFC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello there,
I have the following construct, which works a little but not really
properly: I am using a MS Access Database, with the certain table
'EventTree'. 'EventTree' has 3 fields: 'ID' (Auto-Inc), 'Name' (Text),
and 'EventTree' (OLE). In my program I have a form, on which I have
placed a DBGrid (connected only to the 'Name'-field of the
'EventTree'-table) and a TTreeView-component.
What I want to do is to load TTreeView-data from the 'EventTree'-field,
and display it in the TTreeView-component. Of couse, I want to save
changes in the TTreeView-component to the table.
I started to implement this using a TBlobStream. In the procedure 'Load'
I have the following code:
BlobStream:=TBlobStream.Create(TblEventTree.FieldByName(FnEventTree)
as TBlobField,bmRead);
if BlobStream<>nil then TvEventTree.LoadFromStream(BlobStream);
BlobStream.Free;
In the corresponing procedure 'Save' you find the following code-pieces:
with TblEventTree do
begin
Edit;
BlobStream:=TBlobStream.Create(FieldByName(FnEventTree) as
TBlobField,bmReadWrite);
TvEventTree.SaveToStream(BlobStream);
Post;
end;
BlobStream.Free;
As I said, it works a little (loading the event-trees), but as soon as I
save it for the first time, the occur error-messages, when I scroll
through the dataset: 'BLOB already open' and 'BLOB not open'.
In the documentation and in most of the Delphi-literature you hardly
find anything about BlobStreams and how you can use they. If somebody of
you sees what I am doing wrong in my program, please send me corrections
or suggestions.
Thanx,
Mike
--------------7D5FAD9DA3823A084A3C6AFC
Content-Type: text/x-vcard; charset=us-ascii;
name="mhuth.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte f�r Michael Huth
Content-Disposition: attachment;
filename="mhuth.vcf"
begin:vcard
n:Huth;Michael
x-mozilla-html:FALSE
org:Seminar fuer Logistik und Verkehr
adr:;;Mertonstrasse 17 - 25;Frankfurt;;60054;Germany
version:2.1
email;internet:mhuth@wiwi.uni-frankfurt.de
title:Dipl.-Kfm.
x-mozilla-cpt:;0
fn:Michael Huth
end:vcard
--------------7D5FAD9DA3823A084A3C6AFC--
Technical Details
Message-ID:
<370B17FD.3D61FE78@wiwi.uni-frankfurt.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffff5,ed3625ea1279a04f,start X-Google-Attributes: gidffff5,public X-Google-Thread: ff75c,ed3625ea1279a04f,start X-Google-Attributes: gidff75c,public From: Michael Huth <mhuth@wiwi.uni-frankfurt.de> Subject: Saving TTreeView in a Database using TBlobStream Date: 1999/04/07 Message-ID: <370B17FD.3D61FE78@wiwi.uni-frankfurt.de> X-Deja-AN: 463565058 X-NNTP-Posting-Host: 141.2.144.142 X-Accept-Language: de Content-Type: multipart/mixed; boundary="------------7D5FAD9DA3823A084A3C6AFC" X-Trace: 7 Apr 1999 10:30:40 +0100, 192.168.21.179 Organization: Seminar fĂźr Logistik und Verkehr MIME-Version: 1.0 Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop