473,396 Members | 1,917 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,396 software developers and data experts.

Opening an Image from SQL database

I am trying to open an image from a binary field in SQL Server. I
have got a far as making an object which holds the image. I have done
this using an example off the site of microsoft. Now I am trying to
display the image into an image component. The problem is that the
image component wants an image url, unlike a picturebox which takes
the actual image. How can I reference the image object to my image
component? I am still a begener on c#, this is actually my first
project. Some help will really be appreciated. Thanks.
Nov 15 '05 #1
1 1512
Hi Benji,

You have to save the image on a file, this file MUST BE accesible to the
website, after this all you have to do is put the correct url in the Image
object.
Something like this:

string inThisDirectory = Server.MapPath( "/images_from_db"); //convert a
logical path to a physical one
//this get the image from DB and save it on the directory passed as
parameter
//it return the named used.
//NOTE: you should be careful how to name the image to not overwrite another
image, I would suggest use a Guid.NewGuid().ToString() to named it.
string imagename = GetImageFromDBAndSaveItOnFile( inThisDirectory );

Image.ImageUrl = "/images_from_db/" + imagename;
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Benji" <il*******@hotmail.com> wrote in message
news:b6**************************@posting.google.c om...
I am trying to open an image from a binary field in SQL Server. I
have got a far as making an object which holds the image. I have done
this using an example off the site of microsoft. Now I am trying to
display the image into an image component. The problem is that the
image component wants an image url, unlike a picturebox which takes
the actual image. How can I reference the image object to my image
component? I am still a begener on c#, this is actually my first
project. Some help will really be appreciated. Thanks.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johannes Götzinger | last post by:
hello everyone, I use a script to save .jpg-images in a mysql database. Another small script outputs the database-stored-image to the browser (getdbfile?id=1). All works fine. Now I want to...
0
by: Hari Prasad | last post by:
Hi, I have downloaded some image files by connecting to a URL and I am trying open that image file using BrowserLauncher. I am using windows xp and the default one to open image files is windows...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
3
by: MarkW | last post by:
Hi, I have a Javascript heavy application that I need to record stats from for each click that the user makes. For all intents and purposes this is a shopping cart application that employs a...
4
by: Shumit Rehman | last post by:
Hi I have a table which has path names to photos I would like to view. I would like to open some/any kind of image viewer(Paint) to see the picture when I click the pathname. The pictures are...
1
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to...
2
by: Craig | last post by:
Hi there, I'm trying to open colour BMPs using PIL and I'm getting the following errors. Opening a 16 colour BMP I get: Traceback (most recent call last): File "<pyshell#3>", line 1, in...
1
parshupooja
by: parshupooja | last post by:
Hello, I am using ASp.NEt C# and javascript I have a Datalist control on my page which has3 columns name , image and description. i have around 40 items in it. I want user to click on Image to...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.