 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
joshua Guest
|
Posted: Thu Jan 08, 2004 12:40 pm Post subject: paradox table blob fields |
|
|
Hi all,
Somebody mind giving me some help on how to write to and read from the
Graphic Blob fields in Paradox tables for windows 7.0??
I am trying to make an application that will give the user the choice to
load an image into his/her database; probably via an OpenDialog.
Any ideas and hints please???
thanx all.
Joshua.
|
|
| Back to top |
|
 |
bcb Guest
|
Posted: Fri Jan 09, 2004 3:45 am Post subject: Re: paradox table blob fields |
|
|
Hi :-)
A Graphic field makes it very simple, but note that it can only accept
Bmp's. You can use a binary field to hold any type of file you wish.
To view the content of the graphic field just use a TDBImage , to save data
to the graphic field
if (OpenDialog1->Execute())
{
Table1->Edit();
DBImage1->Picture->LoadFromFile(OpenDialog1->FileName);
Table1->Post();
}
or
//you can use this method for a graphic or binary field
if (OpenDialog1->Execute())
{
Table1->Edit();
Table1->FieldByName("Graphic Field
Name")->LoadFromFile(OpenDialog1->FileName);
Table1->Post();
}
If decide to use a binary field to save a jpeg file then use a TImage to
display the image then something like this could work, it's just a sample to
give an idea, doesn't handle errors or check the file format.
#include <Jpeg.hpp>
TMemoryStream *Memory = new TMemoryStream ();
TJPEGImage *Image = new TJPEGImage ();
Table1->FieldByName("Picture Field")->SaveToStream (Memory);
Memory->Seek (0, soFromBeginning);
Image->LoadFromStream (Memory);
if(Memory->Size==0)
Image1->Picture=NULL;
else if(Memory->Size>0)
Image1->Picture->Assign (Image);
delete Memory, Image;
Hope this helps :-)
|
|
| Back to top |
|
 |
joshua Guest
|
Posted: Sat Jan 10, 2004 1:39 pm Post subject: Re: paradox table blob fields |
|
|
"bcb" <noemail (AT) sorry (DOT) com> wrote
| Quote: | Hi :-)
A Graphic field makes it very simple, but note that it can only accept
Bmp's. You can use a binary field to hold any type of file you wish.
To view the content of the graphic field just use a TDBImage , to save
data
to the graphic field
if (OpenDialog1->Execute())
{
Table1->Edit();
DBImage1->Picture->LoadFromFile(OpenDialog1->FileName);
Table1->Post();
}
or
file://you can use this method for a graphic or binary field
if (OpenDialog1->Execute())
{
Table1->Edit();
Table1->FieldByName("Graphic Field
Name")->LoadFromFile(OpenDialog1->FileName);
Table1->Post();
}
If decide to use a binary field to save a jpeg file then use a TImage to
display the image then something like this could work, it's just a sample
to
give an idea, doesn't handle errors or check the file format.
#include <Jpeg.hpp
TMemoryStream *Memory = new TMemoryStream ();
TJPEGImage *Image = new TJPEGImage ();
Table1->FieldByName("Picture Field")->SaveToStream (Memory);
Memory->Seek (0, soFromBeginning);
Image->LoadFromStream (Memory);
if(Memory->Size==0)
Image1->Picture=NULL;
else if(Memory->Size>0)
Image1->Picture->Assign (Image);
delete Memory, Image;
Hope this helps :-)
|
Thanks for that,
bcb help couldnt helpp me much,
cheers
joshua
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|