Solved

Problem with BLOB field

Posted on 1997-06-23
3
324 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Print Graphic and Text to Epson TM-T88v 12 561
How to debug For loops? 3 75
Dynamically Created Query 3 81
how to make 2 step back? ..\..\ ExtractFilePath (paramstr(0)) 5 84
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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