[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

CreateBlobStream Question

Posted on 1999-11-18
4
Medium Priority
?
1,003 Views
Last Modified: 2012-05-04
Hi.

I need to save some binary files within a Paradox 7 database.  I have created the database using the Database desktop and set the field type as Binary.  However, when I try to copy the file into the Binary field, I get a stream write error.

Here's the code I am using:

Var stmData: TStream;
    stmFile: TFileStream;

begin
   stmFile := TFileStream.Create('C:\COMMAND.COM', fmOpenRead);
   stmData := tbProducts.CreateBlobStream(tbProducts.FieldByName('Data'), bmReadWrite);
   tbProducts.Append;
   stmData.CopyFrom(stmFile, stmFile.Size);
   tbProducts.Post;
   stmData.Free;
   stmFile.Free;
End;

What am I doing wrong??

Thanks for any help,

Stu.
0
Comment
Question by:Stuart_Johnson
  • 2
4 Comments
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 2218567
Edited text of question.
0
 
LVL 5

Expert Comment

by:inter
ID: 2218683
Hi Stu,

In which one you get an error? Command.com could be locked so may be we may use
TFileStream.Create('C:\COMMAND.COM', fmOpenRead or fmShareDenyNone);
or
TFileStream.Create('C:\COMMAND.COM', fmOpenRead or fmShareCompat);

igor
0
 
LVL 1

Accepted Solution

by:
men xin earned 400 total points
ID: 2218687

Var stmData: TblobStream;
    stmFile: TFileStream;
begin
   stmFile := TFileStream.Create('C:\COMMAND.COM', fmOpenRead);
   tbProducts.Append;
   stmData :=Tblobstream.create(tbProducts.FieldByName('Data'), bmWrite);
   stmData.CopyFrom(stmFile, stmFile.Size);
   tbProducts.Post;
   stmData.Free;
   stmFile.Free;
End;


0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 2218789
Thanks menxin, I am honestly not with it today.  I can't believe I overlooked that!

Working wonderfully now!

Stu.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

591 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