Board index » delphi » Loading a BMP into a BLOB field in a Paradox Table

Loading a BMP into a BLOB field in a Paradox Table

Hi all

Can anyone help me with the following>>>
I have a paradox7 table with a graphic blob field in it, a form with a
button named import and a OpenDialog component.
When the user clicks on the import button the opendialog  opens where the
user can select the file image that he wants to import into the database.
Now the problem that I have is that Image file imports into the database
without any errors, but when I try to view it through TDBImage, it gives me
invalid BMP image. I have tried just about every BMP image that I have.

I have used the following code.

Procedure ImportButtonClick blabla
     if OpenDialog1.Execute then
       ProfileTable.FieldByName('Logo').assign(Opendialog1.files);

Maybe I am doing this completely incorrect, but is there anyone out there
that has tried the samething and got it right or anyone that could put me in
the right direction.

Thanks in advance

Ray

 

Re:Loading a BMP into a BLOB field in a Paradox Table


Quote
>Ray wrote:

> Procedure ImportButtonClick blabla
>      if OpenDialog1.Execute then
>        ProfileTable.FieldByName('Logo').assign(Opendialog1.files);

Here is one possibility that should work:

(Table.FieldByName('Logo') as TBlobField).LoadFromFile(Opdlg.Filename);
________
Andreas
Delphi 5.01 Pro, NT4.0 Sp5
Direct replies mailto:p...@augsburg.netsurf.de

Re:Loading a BMP into a BLOB field in a Paradox Table


Thanks a lot for putting stuff for adding images as BLOBS. It is quite
useful for me too.

I have jpg images, so it gives error.

Could you please help me how to add jpg images.

thanks

In article <3988570D.F0E0F...@augsburg.netsurf.de>,
  Andreas Pawlik <no~j...@augsburg.netsurf.de> wrote:

Quote
> >Ray wrote:

> > Procedure ImportButtonClick blabla
> >      if OpenDialog1.Execute then
> >        ProfileTable.FieldByName('Logo').assign(Opendialog1.files);

> Here is one possibility that should work:

> (Table.FieldByName('Logo') as

TBlobField).LoadFromFile(Opdlg.Filename);

Quote
> ________
> Andreas
> Delphi 5.01 Pro, NT4.0 Sp5
> Direct replies mailto:p...@augsburg.netsurf.de

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads