BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

paradox table blob fields

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
joshua
Guest





PostPosted: Thu Jan 08, 2004 12:40 pm    Post subject: paradox table blob fields Reply with quote



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





PostPosted: Fri Jan 09, 2004 3:45 am    Post subject: Re: paradox table blob fields Reply with 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

//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





PostPosted: Sat Jan 10, 2004 1:39 pm    Post subject: Re: paradox table blob fields Reply with quote







"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.