Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2012, 09:15 PM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default store image in database sql server

hi
i want store image (*.jpg) in database sql server
i create "image" field in sql table

if record count over 1000 then program speed very slow.

another way :
save image in directory in drive and store file path in database

What should I do?
Reply With Quote
  #2  
Old 05-08-2012, 03:28 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 880
Default

Store the location of the image in the DB. It is a much more versatile way to do this. I do this and put the main storage location in an INI file. That way if you have to move the images, you only need to change the INI file. Everything else stays the same.

George
Reply With Quote
  #3  
Old 05-08-2012, 04:19 AM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default

thank you

have you example code for send me?
Reply With Quote
  #4  
Old 05-08-2012, 10:26 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,269
Default

Then your query is not ok, why you even need 1000 images, you can never display them???
Only fetch the image if it's asked, not all...

This is all the information I can give you with the limited information you provide
Reply With Quote
  #5  
Old 05-09-2012, 03:36 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 880
Default

You should check out the INI file in Help or online. Basics are...

YourIni := TIniFile.Create('YourINI.ini');
DirectoryPicLoc := YourIni.ReadString('PicLoc','DirectoryPhotoLoc','c :\');
YourIni.Free;

Where YourIni: TIniFile;

You need to get the photo directory somehow and set the INI file.

YourIni := TIniFile.Create('YourINI.ini');
YourIni.WriteString('PicLoc','DirectoryPhotoLoc',D irectoryPicLoc);
YourIni.Free;

DirectoryPicLoc is a String.

The image is DirectoryPicLoc + '\' + FieldByName('YourImage').asString

Hope this helps a bit.

George
Reply With Quote
  #6  
Old 05-14-2012, 03:28 AM
delphimpd delphimpd is offline
Senior Member
 
Join Date: Oct 2006
Posts: 701
Default

I have to agree with Norrit

I have a Table with about 1 million Records and each of them contain Images. I use MSSQL 2005 and the speed is very fast (instantly). So you must be doing some wrong with your query.

Regards,
Reply With Quote
  #7  
Old 05-16-2012, 08:30 PM
Donovan Donovan is offline
Senior Member
 
Join Date: Jan 2011
Posts: 150
Send a message via Skype™ to Donovan
Default

You could implement a master/slave table design. The master table contains all the regular data like strings, integer values and so on, and then the slave table contains the image. Then all you need is a common field in the two tables so you can link them.

However I don't really see why you would be having speed issues with only 1000 records...
Reply With Quote
  #8  
Old 05-28-2012, 08:27 AM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default

I personally don't store the links to the images, on our server, you never know if an image goes MIA, I prefer to store the image itself in the table.
However, I don't have that many images, so can't comment on when it reaches 1000 images.
Are you talking about retrieving all 1000 images simultaneously, or when you have 1000 stored in your table?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:38 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.