GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ADO.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ADO.NET 2.0  |  Question 18 of 19    Print  
how we can show image from database to our web form

  
Total Answers and Comments: 4 Last Update: March 02, 2009     Asked by: nidhi.amulya 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: gvmca_2003
 
Create a folder in the application directory. Store the images in that folder. At the same time store the Image path in the database. when u r retriving the images just take image control and assign the image path from the database. u have input type = file in html right. using that we can upload and save in to the database. Hope u will get an idea.

Above answer was rated as good by the following members:
ravimittal16
June 02, 2008 02:24:51   #1  
gvmca_2003 Member Since: June 2007   Contribution: 1    

RE: how we can show image from database to our web form
Create a folder in the application directory. Store the images in that folder. At the same time store the Image path in the database. when u r retriving the images just take image control and assign the image path from the database. u have input type file in html right. using that we can upload and save in to the database. Hope u will get an idea.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 1Overall Rating: -N/A-    
July 09, 2008 14:07:17   #2  
ynvpavan Member Since: September 2007   Contribution: 16    

RE: how we can show image from database to our web form
use ascx control so that the image stored in DB can be retrieved easily even in which format it will be.....
 
Is this answer useful? Yes | No
August 11, 2008 05:23:34   #3  
s4net Member Since: August 2008   Contribution: 1    

RE: how we can show image from database to our web form
You need to create one folder in your application named Images and store all the images in this folder. Now in your table add one column named Image_Url and save the path of each image. now in your .aspx page take one Image control and in the ImageUrl property bind the column. For example 'To upload an Image you need to use FileUpload control. and use saveas property to save that image in your application folder.Hope this can help you.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
March 02, 2009 12:25:14   #4  
ajayms2000 Member Since: March 2009   Contribution: 2    

RE: how we can show image from database to our web form
What I understand from your question is that you have the image content in your data base and wants to read it from there and show it to web page.

If I am right in my perception then a simple solution would be as follows.

Setup a virtual directory and give it necessary write permission for (Network Service if u r using unauthorized access. otherwise for the user under which you application runs in windows authentication mode).

Read the image content from the database into a byte array (byte[]). Now create a filestream object with a new filename targeting the early mentioned folder. Now write your array to the stream. Flush the stream and dispose it. Now you can easily build relative/absolute url for that file and bind it to your image control in your page.

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape