Question:
How do store pictures in Sql Database?
Amjad khan
2006-06-27 00:24:41 UTC
In Vb I want show employee details(id,name,doj,deprt, and his picture).
In crystal report i want to show his picture in employee details reports.
Please any body knows please tell me how i can programe
Six answers:
The Shockwave
2006-06-27 00:36:28 UTC
It depends how large the pictures are, but you could make a BLOB (64KB) or MEDIUMBLOB (4MB) field in your employee details table. (A BLOB is much like a binary varchar with a preset maximum length.) Then using mysql_real_query you can enter and extract the binary data from the table.



mysql_real_query is the same as mysql_query, but you must give it a query length, since it cannot rely on a NULL character to terminate the query string.
torosorogoro
2006-06-27 08:07:26 UTC
As the others said, don't store the pictures in the DB. Store them somewhere on the server. Important is to have a dummy picture if there exist no picture for something, for example a gray picture with a question mark. This picture will be shown if no picture exists.



Here is the VB-Source code to get them from the server:



Me.imgMyImage.Stretch = True

Me.imgMyImage.Visible = True

Me.imgMyImage.Picture = LoadPicture(App.Path & "\MyImages\" & Trim(rsMyDatabase!PictureFilename) & ".jpg")



That was it. Very simple.
vlad_bv2005
2006-06-27 07:32:14 UTC
In a Sql Database or all database for that mater you ca only tore alphanumeric strings.No pictures,no music.In order to get the desired effect you need to configure the java script used fore the query.
Venkatraman M
2006-06-27 09:00:47 UTC
You can store and access image from SQL Server its possible.



While creating a table you can set a column type as image.



Please see the fallowing examples.
MrMonkey
2006-06-27 07:28:12 UTC
Keep the picture on a server somewhere and store the UNC path (or a URL, depending on your app) to it in your database.



e.g.

\\server1\employees\pics\terrytester.jpg

http://server1/employees/pics/terrytester.jpg
Spitrabergâ?¢
2006-06-27 09:27:28 UTC
you can write image in binary formad to text field in db


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...