Solved

Problem with BLOB field

Posted on 1997-06-23
3
321 Views
Last Modified: 2010-04-04
I'am try to save some binary data to a blob field, via a
blob stream. The problem is I get a "BLOB not opened error".
Code fragment

  }
   Table1Data is a persistent field of TBlobField Type
  {
 
   DStream := TBlobStream.Create(Form1.Table1Data,
   bmReadWrite);
   While Not EOF(DataFile) DO
     Begin
      BlockRead(DataFile,HeaderRecord,SizeOf(HeaderRecord),
                                                 NumRead);
      EndOfHeader := FilePos(DataFile);
      For i := 0 To HeaderRecord.RecCount -1 DO
       Begin
         BlockRead(DataFile,DataRecord,SizeOf(DataRecord),
                                                 NumRead);
         FieldPos := DStream.Write(DataRecord,
                             SizeOf(DataRecord));
       End;

I have no problems with the other fields in the table
0
Comment
Question by:mikedodsworth
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
Gabor earned 150 total points
ID: 1337632
The easiest way is to save the data from your datafile to the blob as a whole:var  fs: TFileStream;begin  fs:=TFileStream.Create(DataFileName,fmRead);  try    Form1.Table1Data.LoadFromStream(fs);  finally    fs.Free;  end;end;If you have to use your own code, I think you have to set table to edit state with the Edit method.
0
 
LVL 1

Expert Comment

by:Gabor
ID: 1337633
Sorry mikedodsworth, but my CR-s disappeard. I don't know why.
0
 

Author Comment

by:mikedodsworth
ID: 1337634
Gabor, I have tried putting the edit mode but it still fails.
The problem with saving the data file as whole is that
the file contains many seperate records with header info.So I
am still open to offers on the orignal code.
Thanks Mike.
 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now