473,563 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1521
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 = GetImageFromDBA ndSaveItOnFile( 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*******@hotm ail.com> wrote in message
news:b6******** *************** ***@posting.goo gle.com...
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
2488
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 resize these images from the database using the GD libraries. But I always get an error while opening the 'dynamic'-database-image:
0
3356
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 picture and Fax Viewer. I could not see the image in Internet Explorer when I am trying to open the image files. But when I set in the properties of...
14
11039
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 window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin =...
3
1594
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 neat visual DHTML page turning. This comprises an online brochure with all content loaded in to client on page load. I had to avoid requesting new...
4
13722
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 mostly scanned newspaper atricles which are too big to just display on a form so I need the zoom and scroll features. Im using access 2003
1
3036
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 allow movie (wmv) playback on mouse click. (All animations have been verified to work when viewing slides in ppt.) Further, I have ensured that the...
2
5008
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 <module>
1
1241
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 open an enlarged Image. Enlarged Image path is not in database. Images are saved in diffrent folder but exactly with the same name as small image in...
16
5158
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 Storage_Click() On Error GoTo Err_Storage_Click
0
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.