Solved

Problem with BLOB field

Posted on 1997-06-23
3
325 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

Independent Software Vendors: 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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month4 days, 8 hours left to enroll

636 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