473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

To bind image control

Hi,

How to bind the images from database say sqlserver to the image control. Can anyone send a sample code snippet?
Aug 30 '07 #1
3 2302
dip_developer
648 Expert 512MB
Hi,

How to bind the images from database say sqlserver to the image control. Can anyone send a sample code snippet?
here is your answer...

diplay image in image control after retreiveing from database
Aug 30 '07 #2
here is your answer...

diplay image in image control after retreiveing from database

I have read this article. and picture is also coming. But my problem is i could not bind it to image control. I cant assign Response.BinaryWrite(myReader("Image")) to a string or byte variable.


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
Dim mypic As Image
If myReader.Read Then
Response.ContentType = myReader("MIMEType").ToString()
Response.BinaryWrite(myReader("Image"))

End If
myReader.Close()
myconnection.Close()
Aug 30 '07 #3
here is your answer...

diplay image in image control after retreiveing from database

Thank you for your help. I figured it out. Now it is working.
Aug 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following...
10
by: David W. Simmonds | last post by:
I have a DataList control that has an Image control in the ItemTemplate. I would like to resize the image that goes into that control. I have a series of jpg files that are full size, full...
3
by: euan | last post by:
Hey guys, I am just playing around with asp.net 2.0 and I was reading about the image control (for mobile designer) and thought that would be handy. So I have created: Do While...
0
by: Milsnips | last post by:
hi there, i have a repeater with 1 image control. I also have a function that generates a dynamic thumbnail from an image, and returns it as a stream, but i cant figure out how to bind it to the...
1
by: Brian | last post by:
Using A2K I have an image control on a report and use code to set the image.picture to the required jpg. 3 of the jpgs resize properly but 2 do not - they display much smaller than the image...
2
by: markcash | last post by:
I am trying to bind an ASP.NET image control to images stored locally on the hard drive of the web server. The images will be frequently changing so I am dynamically creating the filename. I am...
0
by: gomzi | last post by:
Is it possible to bind a bitmap image to a image control?
1
by: wardemon | last post by:
Hi, I have an image control which inside an ItemTemplate of a GridView Control. I've coded the ImageControl's ImageURL in "Source" to have a dynamically filled-up value ex: ImageURL = <%#...
0
by: SayamiSuchi | last post by:
hi I have taken one image control("image1") in the form("frmForm1.aspx").Now i want to one image ("mypic.jpeg") whose size is larger than the image control i.e image1.When i run the program, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.