Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to store OLE objects in a blob field Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Aug-02
Category
OLE
Language
Delphi 2.x
Views
161
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How would I store an OLE object into a database's blob field and preferably be able 
to read it back in a usable form later on?

Answer:

To write a TOLEContainer to a blobfield:

1   var
2     Stream: TBlobStream;
3   begin
4     Stream := TBlobStream.Create(myOleField, bmWrite);
5     try
6       Ole1.SaveToStream(Stream);
7     finally
8       Stream.Free;
9     end;
10  end;
11  
12  //To read it back:
13  
14  var
15    Stream: TBlobStream;
16  begin
17    Stream := TBlobStream.Create(BugData.NotesNote, bmRead);
18    try
19      Ole1.LoadFromStream(Stream);
20      Ole1.Iconic := False;
21    finally
22      Stream.Free;
23    end;
24  end;


Where you put the code is up to you, but the DataChange and UpdateData events of the appropriate TDatasource might be a good idea.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC