how to display pictures in image tool
-
Hi, how to bind image present in sql server to image tool.
Chaitra N
-
Hi, how to bind image present in sql server to image tool.
Chaitra N
take the binary of the image from database. make a stream. write that stream into a blank Web User Control. as Response.Write and then assign it to your image control as ImageURL="myPic.ascx" I hope you understand what I mean. Regards, Ather Ali
Ather Ali Shaikh Project Manager Micromedia Computer shaikhather@gmail.com
-
take the binary of the image from database. make a stream. write that stream into a blank Web User Control. as Response.Write and then assign it to your image control as ImageURL="myPic.ascx" I hope you understand what I mean. Regards, Ather Ali
Ather Ali Shaikh Project Manager Micromedia Computer shaikhather@gmail.com
Hi Ather Ali, I understood what you are telling but not getting how to do it. I have the following code. Picture is getting displayed. It is ok. But not in the image control. suppose if I have a imagecontrol Image1 how can i do this? Dim ImageID As Integer = Convert.ToInt32(Request.QueryString("ImageID")) 'Connect to the database and bring back the image contents & MIME type for the specified picture Const SQL As String = "SELECT [MIMEType], [Image] FROM [Pictures] WHERE [ImageID] = @ImageID" Dim myCommand As New SqlCommand(SQL, myconnection) myCommand.Parameters.AddWithValue("@ImageID", 1) myconnection.Open() Dim myReader As SqlDataReader = myCommand.ExecuteReader If myReader.Read Then Response.ContentType = myReader("MIMEType").ToString() Response.BinaryWrite(myReader("Image")) End If myReader.Close() myconnection.Close()
Chaitra N
-
Hi Ather Ali, I understood what you are telling but not getting how to do it. I have the following code. Picture is getting displayed. It is ok. But not in the image control. suppose if I have a imagecontrol Image1 how can i do this? Dim ImageID As Integer = Convert.ToInt32(Request.QueryString("ImageID")) 'Connect to the database and bring back the image contents & MIME type for the specified picture Const SQL As String = "SELECT [MIMEType], [Image] FROM [Pictures] WHERE [ImageID] = @ImageID" Dim myCommand As New SqlCommand(SQL, myconnection) myCommand.Parameters.AddWithValue("@ImageID", 1) myconnection.Open() Dim myReader As SqlDataReader = myCommand.ExecuteReader If myReader.Read Then Response.ContentType = myReader("MIMEType").ToString() Response.BinaryWrite(myReader("Image")) End If myReader.Close() myconnection.Close()
Chaitra N
This Code is OK. Put this code in a ASCX control and take the ImageID from QueryString. and there should not be any thing in HTML side. Whereever you want to put this image on any page. place a image control on that page and as source refere to this control like I hope it will sove your problem. I have already did it in my one of the application. Regards, Ather Ali
Ather Ali Shaikh Project Manager Micromedia Computer shaikhather@gmail.com
-
This Code is OK. Put this code in a ASCX control and take the ImageID from QueryString. and there should not be any thing in HTML side. Whereever you want to put this image on any page. place a image control on that page and as source refere to this control like I hope it will sove your problem. I have already did it in my one of the application. Regards, Ather Ali
Ather Ali Shaikh Project Manager Micromedia Computer shaikhather@gmail.com
Thank you. It worked.
Chaitra N