?
Solved

database problem with delphi progra

Posted on 2003-12-02
9
Medium Priority
?
359 Views
Last Modified: 2010-04-05
hi i wrote a program which generates buttons with the fields from the database but i would really like that button generation program to generate pictures instead of the text field to do exacly teh same generate buttons  but wit6h the pictures.
i cannot post it anywhere but if somebody feels up to the task the all they have to do is supply me with the e-mail and i will send that file to them
then afterwe done we will post the source code
i am using access database for now
thanks
ps.picture generation programm which will take the pictures stored in the databse under the text fields
thanks
0
Comment
Question by:george_4
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 1

Expert Comment

by:roknjohn
ID: 9859769
Here's the best way I've found to read/write images (or any blob for that matter) to MS Access or MS SQL databases, using ADO:  

procedure LoadBlobStream(Stream : TStream; Blob : TBlobField);
var
  dbStream : TADOBlobStream;
begin
  try
    dbStream := TADOBlobStream.Create(Blob,bmRead);
    dbStream.SaveToStream(Stream);
  finally
    dbStream.Free;
  end;
end;

procedure SaveBlobStream(Stream : TStream; Blob : TBlobField);
var
  dbStream : TADOBlobStream;
begin
  with Blob.DataSet do begin
    if State = dsBrowse then
      Edit;
    try
      dbStream := TADOBlobStream.Create(Blob,bmWrite);
      dbStream.LoadFromStream(Stream);
    finally
      dbStream.Free;
    end;
  end;
end;


What kind of button control did you have in mind?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9859957
it goes easier, via typecasting like

//store -> dataset must be in edit/insert-mode
TBlobField(Dataset,FieldByName('BlobFieldName')).LoadFromFile('FileNameHere); //or LoadFromStream

//get
TBlobField(Dataset,FieldByName('BlobFieldName')).SaveToFile('FileNameHere); //or SaveToStream

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9859971
oops there should be a dot :-))

Dataset,FieldByName -> Dataset.FieldByName
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:roknjohn
ID: 9860024
I've had problems in the past when I didn't use a TADOBlobStream.  

I think there is a discussion about it on delphi.about.com, I'll have to find the link.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9860074
well, the typecast causes,
that vcl-intern the blobstream is created and freed,
like your code above (which looks good)

there may a problem with persistent fields
(which is not used by this typecast)

would be nice, if you find the link, roknjohn

meikl ;-)
0
 
LVL 1

Assisted Solution

by:roknjohn
roknjohn earned 315 total points
ID: 9860167
Well, this is one discussion, but not the one I had in mind..

http://delphi.about.com/library/weekly/aa030601a.htm

I'll have to look back at the research I did last year when developing a document imaging system with a MSSQL backend.  For some reason, the TADOBlobStream was the only way to go.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 315 total points
ID: 9860220
well, thats a discussion about the oleobject-field-type of access
(i personal dislike this kind of fieldtype with oleinformation-header
and use it as ordinary blobfield without oleinformation-header,
which has as fallback, that the cannot diplayed with the access-
frontend)

meikl ;-)
0
 

Author Comment

by:george_4
ID: 9862061
ok
but i already have it generate buttons from the text fields now i want that program
to read the pictures beside instead of the text field and i aslo have no idea how to put it in access
i can send the source if anybody wants to take a look
or better i will post it tonight once i get home
thanks
0
 

Author Comment

by:george_4
ID: 9863950
ok and i want to read from the same table from the databse
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 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