Last post Jul 12, 2011 11:49 AM by Nighthawk0712
Jul 05, 2011 01:05 PM|Nighthawk0712|LINK
IF anyone can help out with the above mentioned, the best way possible. That would be great. I am not a expert.
Jul 05, 2011 01:16 PM|ddelella|LINK
The third answer from sreejukg is the best one. It shows how to retrieve and image from a database column and assign it to an Image control. If you are putting the image in a grid you just neew to use ImageField from the GridView control.
Jul 06, 2011 10:07 AM|Nighthawk0712|LINK
I am including my code for what I have done and get an error that cannot convert byte to string:
Dim StrConn As String = "Server=Cactas;Database=Reclassification;User ID=XXXXX;Password=XXXXXXX;"
Dim sql As String = "Select mugshot from tblJMSImage where JMS_Number = '" & DocketTxt.Text & "'"
Dim Conn As New SqlConnection(StrConn)
Dim objdr As SqlDataReader
Dim cmd As New SqlCommand(sql, Conn)
objdr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
JMSImg.ImageUrl = objdr("Mugshot")
Response.ContentType = "image/jpeg"
Catch ex As Exception
ErrorLbl.Text = ex.Message
I am using the Docket to retrieve the image. Any help would be great.
Jul 07, 2011 09:01 AM|Nighthawk0712|LINK
It makes sense, but I am trying to retrieve the image based on what is put in a textbox. How do I account for that?
Jul 07, 2011 09:25 AM|ddelella|LINK
What is the input of the text box? A file path or some variable in a database? The logic is still the same. You need to use the text value given to query the database. The query will return a byte() which has to be added to the HTTP context and returned.
The link provided should cover the retrieval part but you will have to customize the database query to do that portion based on the user input.
Jul 07, 2011 09:53 AM|Nighthawk0712|LINK
It is a value in the database.
Jul 09, 2011 11:47 AM|Anne Meng - MSFT|LINK
Thank you for your post.
Support there are two columns in a table:
You just need to call a SELECT clause from .NET side to get and display a image using its ID.
I would like to share these articles with you:
How To Access and Modify SQL Server BLOB Data by Using the ADO Stream Object
Save and retrieve images with SQL Server
VB .NET (WPF)] [Displaying images from SQL Server DB]
ving Images from SqlServer and displaying in a DataGrid - ASP .NET
How can I show an image field SQL Server using VB.Net
Jul 11, 2011 10:30 AM|Nighthawk0712|LINK
Thank you for getting back to me. The third link looks like what I can use, but it has a link to a directory locations. The image is stored in the db. Would I just take out the link to the directory?
Jul 12, 2011 01:18 AM|eralper|LINK
Here is a sample application with ASP.NET codes
http://www.kodyaz.com/articles/file-upload-and-save-to-sql-server.aspx where the images are stored in SQL Server database
I hope that may be helpful
Jul 12, 2011 11:49 AM|Nighthawk0712|LINK
I found a lot easier way to do this via Crystal Report and I can format to the way the group needs. I have learned from the posts. I want thank everyone who replied and posted. The replies that contain information will be kept in mind for further reference.