Wednesday, March 28, 2012
How to save images to SQL Server?
I have a question?
I have scanned images (file format .tif) i need to store them in SQL Server.
And after all how fast is the search for those images (search on 200
thousands images and up)
Thank you,
Are you going to put some other fields for searching purpose e.g. file
name, date created, creator etc? Since they are image files, what kind
of search you want to put it on?
Mel
|||Hi,
Thank you for replay,
It will be one field "Ticket No", and i need to search by this field.
So it is possible, where i can get some more references? and SQL Server 2005
will be the answer
"MSLam" wrote:
> Are you going to put some other fields for searching purpose e.g. file
> name, date created, creator etc? Since they are image files, what kind
> of search you want to put it on?
> Mel
>
Monday, March 26, 2012
How to save images to SQL Server?
I have a question?
I have scanned images (file format .tif) i need to store them in SQL Server.
And after all how fast is the search for those images (search on 200
thousands images and up)
Thank you,Are you going to put some other fields for searching purpose e.g. file
name, date created, creator etc? Since they are image files, what kind
of search you want to put it on?
Mel|||Hi,
Thank you for replay,
It will be one field "Ticket No", and i need to search by this field.
So it is possible, where i can get some more references? and SQL Server 2005
will be the answer
"MSLam" wrote:
> Are you going to put some other fields for searching purpose e.g. file
> name, date created, creator etc? Since they are image files, what kind
> of search you want to put it on?
> Mel
>|||... still don't qutie get your question. I shall take it as follow:
You have a table that has at least two fields: Ticket No and Image.
The Ticket No will be using INT as the data type and the Image will be
using text/image data type.
You will be using Ticket No for users to search on OR
You will be using Image for users to search on
If ticket no will be the field users need to search on, it should not
take long to retrieve records (assuming the Ticket no here is data type
int). You can put a normal index on the field to speed up the search
(either clustered or non-clustered depending your situation).
If image will be the field users need to search on (based on text value
in the image file), you use FULL-TEXT index for this purpose.
Check BOL for more information about indexing.
Hope I got your question right.
Mel|||Thank you, Mel
I need perform search on "ticket No" field and if found ti retrive the image
.
Thanks again,
"MSLam" wrote:
> .... still don't qutie get your question. I shall take it as follow:
> You have a table that has at least two fields: Ticket No and Image.
> The Ticket No will be using INT as the data type and the Image will be
> using text/image data type.
> You will be using Ticket No for users to search on OR
> You will be using Image for users to search on
> If ticket no will be the field users need to search on, it should not
> take long to retrieve records (assuming the Ticket no here is data type
> int). You can put a normal index on the field to speed up the search
> (either clustered or non-clustered depending your situation).
> If image will be the field users need to search on (based on text value
> in the image file), you use FULL-TEXT index for this purpose.
> Check BOL for more information about indexing.
> Hope I got your question right.
> Mel
>
How to save images to SQL Server?
I have a question?
I have scanned images (file format .tif) i need to store them in SQL Server.
And after all how fast is the search for those images (search on 200
thousands images and up)
Thank you,Are you going to put some other fields for searching purpose e.g. file
name, date created, creator etc? Since they are image files, what kind
of search you want to put it on?
Mel|||Hi,
Thank you for replay,
It will be one field "Ticket No", and i need to search by this field.
So it is possible, where i can get some more references? and SQL Server 2005
will be the answer
"MSLam" wrote:
> Are you going to put some other fields for searching purpose e.g. file
> name, date created, creator etc? Since they are image files, what kind
> of search you want to put it on?
> Mel
>|||... still don't qutie get your question. I shall take it as follow:
You have a table that has at least two fields: Ticket No and Image.
The Ticket No will be using INT as the data type and the Image will be
using text/image data type.
You will be using Ticket No for users to search on OR
You will be using Image for users to search on
If ticket no will be the field users need to search on, it should not
take long to retrieve records (assuming the Ticket no here is data type
int). You can put a normal index on the field to speed up the search
(either clustered or non-clustered depending your situation).
If image will be the field users need to search on (based on text value
in the image file), you use FULL-TEXT index for this purpose.
Check BOL for more information about indexing.
Hope I got your question right.
Mel|||Thank you, Mel
I need perform search on "ticket No" field and if found ti retrive the image.
Thanks again,
"MSLam" wrote:
> .... still don't qutie get your question. I shall take it as follow:
> You have a table that has at least two fields: Ticket No and Image.
> The Ticket No will be using INT as the data type and the Image will be
> using text/image data type.
> You will be using Ticket No for users to search on OR
> You will be using Image for users to search on
> If ticket no will be the field users need to search on, it should not
> take long to retrieve records (assuming the Ticket no here is data type
> int). You can put a normal index on the field to speed up the search
> (either clustered or non-clustered depending your situation).
> If image will be the field users need to search on (based on text value
> in the image file), you use FULL-TEXT index for this purpose.
> Check BOL for more information about indexing.
> Hope I got your question right.
> Mel
>sql
How to save image to SQL Server 2000
I have to store images in database. I have a table which contains field picture which is an image.
How can I do this using C# ?
In Visual Studio .NET i found a code how to obtain BLOB values from the database but I do not know how to do upload an image to the database.
Thanks in advance for your help.
RafiIf you go to theData Access forum and search for BLOB you should be able to find the information you need.
Terri|||Thank you for information. I think I found there everything I needed
How to save image in sql server and display that image in datagrid?
Hay Friend's
Can u plese send me the way how to save image in sql server and display that images in datagrid or other control also like Image control or Image control Button?? Plese send the coding in C#.
Thank's
Amit
try this link...it display image in data grid...
http://www.odetocode.com/Articles/172.aspx
and for further reference you can refer
http://forums.asp.net/p/1122135/1754824.aspx#1754824
|||Hi amit, thanks for ur link but I m not fully Satisfy.. so kindly Send me more solutions..Thank'sAmit|||Hi Amit, Thanks for ur Link, but I m not fully Satisfy. So kindly send me more solutions ThanksAmit|||
Hi,
You can use stream object to insert the image to your database. Here's the sample for you to refer.
1.Store image in database:
Int64 intImageSize;string strImageType;Stream ImageStream;// Gets the Size of the ImageintImageSize = PersonImage.PostedFile.ContentLength;// Gets the Image TypestrImageType = PersonImage.PostedFile.ContentType;// Reads the ImageImageStream = PersonImage.PostedFile.InputStream;byte[] ImageContent =new byte[intImageSize + 1];int intStatus;intStatus = ImageStream.Read(ImageContent, 0, intImageSize);// Create Instance of Connection and Command ObjectSqlConnection myConnection =new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));SqlCommand myCommand =new SqlCommand("sp_person_isp", myConnection);// Mark the Command as a SPROCmyCommand.CommandType = CommandType.StoredProcedure;// Add Parameters to SPROCSqlParameter prmPersonImage =new SqlParameter("@.PersonImage", SqlDbType.Image);prmPersonImage.Value = ImageContent;myCommand.Parameters.Add(prmPersonImage);SqlParameter prmPersonImageType =new SqlParameter("@.PersonImageType", SqlDbType.VarChar, 255);prmPersonImageType.Value = strImageType;myCommand.Parameters.Add(prmPersonImageType);try {myConnection.Open();myCommand.ExecuteNonQuery();myConnection.Close();Response.Write("New person successfully added!");}catch (SqlException SQLexc) {Response.Write("Insert Failed. Error Details are: " + SQLexc.ToString());} 2. Retrieving Images from SqlServer and displaying in a DataGrid|||<asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "PersonID"))%>' Runat=server /> </ItemTemplate></asp:TemplateColumn>//And the method FormatURL (A Server side Function) is as follows.public string FormatURL(object strArgument){return ("readrealimage.aspx?id=" + strArgument);}//And the method FormatURL (A Server side Function) is as follows.public string FormatURL(object strArgument){return ("readrealimage.aspx?id=" + strArgument);}///Database partpublic void Page_Load(object sender, EventArgs e){string strImageID = Request.QueryString("id");// Create Instance of Connection and Command ObjectSqlConnection myConnection =new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));SqlCommand myCommand =new SqlCommand("Select PersonImageType, PersonImage from das_person_real_images Where PersonID=" + strImageID, myConnection);// I have used the select statement. But it would be much much better, if you //could write a small stored procedure which contains the above sql statement.// Mark the Command as a SPROC (in case, if you wrote the stored procedure//myCommand.CommandType = CommandType.StoredProceduretry {myConnection.Open();SqlDataReader myDataReader;myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);while ((myDataReader.Read())) {Response.ContentType = myDataReader.Item("PersonImageType");Response.BinaryWrite(myDataReader.Item("PersonImage"));}myConnection.Close();}catch (SqlException SQLexc) {}}Hope that helps. Thanks.
Hi, this is an interesting post. I am curious about if there is something similar you can do to display the SQL image field in a DataGrid in a Windows Forms application too?
Thanks in advance.
Jim