Click here to Skip to main content
15,888,454 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to get the list of files in a folder? Pin
neodeaths23-Jun-11 9:56
neodeaths23-Jun-11 9:56 
AnswerRe: how to get the list of files in a folder? Pin
Ali Al Omairi(Abu AlHassan)23-Jun-11 10:46
professionalAli Al Omairi(Abu AlHassan)23-Jun-11 10:46 
AnswerRe: how to get the list of files in a folder? Pin
Agent__00727-Jun-11 7:18
professionalAgent__00727-Jun-11 7:18 
Questionhow to solve dynamic control panel postback problem? Pin
neodeaths23-Jun-11 9:54
neodeaths23-Jun-11 9:54 
AnswerRe: how to solve dynamic control panel postback problem? Pin
kadaoui el mehdi26-Jun-11 0:32
kadaoui el mehdi26-Jun-11 0:32 
QuestionRegex pattern Pin
padmanabhan N23-Jun-11 3:14
padmanabhan N23-Jun-11 3:14 
AnswerRe: Regex pattern Pin
Keith Barrow23-Jun-11 4:10
professionalKeith Barrow23-Jun-11 4:10 
QuestionDisplaying the image from the Sql Pin
NaveenHS23-Jun-11 2:15
NaveenHS23-Jun-11 2:15 
Displaying the image from the Sql


Hi,

I am trying to display image on the page stored in the SQL DB.


Image is store in the <BinaryData> format in the DB. I am display in the DataGrid its working fine, problem with page.

SqlCommand Cmd = new SqlCommand(Query, myconnection);
       SqlDataReader dr = Cmd.ExecuteReader();
       if (dr.HasRows)
       {
           dr.Read();
           lblProdName.Text = Product;
           lblProdDesc.Text = dr[0].ToString();
           lblPrice.Text = dr[3].ToString();

         //dr[5] image
          byte[] Photo = (byte[])dr[5];
          Response.ContentType = "image/jpeg";
          Response.OutputStream.Write(Photo, 0, Photo.Length);

       }

       dr.Close();


only image is displayed on the page without any other content ,

if I comment lines
// Response.ContentType = "image/jpeg";
// Response.OutputStream.Write(Photo, 0, Photo.Length); 



All the contents are displayed except the image.
what is the proper way to display the image on the page using SQL ??
Please help me with this.


Thanking you,
Naveen.
AnswerRe: Displaying the image from the Sql Pin
Blue_Boy23-Jun-11 4:55
Blue_Boy23-Jun-11 4:55 
AnswerRe: Displaying the image from the Sql Pin
GenJerDan23-Jun-11 6:14
GenJerDan23-Jun-11 6:14 
GeneralRe: Displaying the image from the Sql Pin
Not Active23-Jun-11 7:38
mentorNot Active23-Jun-11 7:38 
GeneralRe: Displaying the image from the Sql Pin
GenJerDan23-Jun-11 7:49
GenJerDan23-Jun-11 7:49 
GeneralRe: Displaying the image from the Sql Pin
Not Active23-Jun-11 8:03
mentorNot Active23-Jun-11 8:03 
GeneralRe: Displaying the image from the Sql Pin
GenJerDan23-Jun-11 8:08
GenJerDan23-Jun-11 8:08 
AnswerRe: Displaying the image from the Sql Pin
RichardGrimmer28-Jun-11 5:05
RichardGrimmer28-Jun-11 5:05 
AnswerRe: Displaying the image from the Sql Pin
Morgs Morgan8-Jul-11 5:19
Morgs Morgan8-Jul-11 5:19 
QuestionStrongly typed ActionLink is not present in vs 2010.. Pin
siva45522-Jun-11 23:45
siva45522-Jun-11 23:45 
AnswerRe: Strongly typed ActionLink is not present in vs 2010.. Pin
Not Active23-Jun-11 2:15
mentorNot Active23-Jun-11 2:15 
QuestionHow to find application URL while using separate script file in asp.net ? Pin
zeego21-Jun-11 20:47
zeego21-Jun-11 20:47 
AnswerRe: How to find application URL while using separate script file in asp.net ? Pin
Vasudevan Deepak Kumar22-Jun-11 10:42
Vasudevan Deepak Kumar22-Jun-11 10:42 
AnswerRe: How to find application URL while using separate script file in asp.net ? Pin
Shahriar Iqbal Chowdhury/Galib22-Jun-11 11:04
professionalShahriar Iqbal Chowdhury/Galib22-Jun-11 11:04 
GeneralRe: How to find application URL while using separate script file in asp.net ? Pin
AspDotNetDev22-Jun-11 11:12
protectorAspDotNetDev22-Jun-11 11:12 
AnswerRe: How to find application URL while using separate script file in asp.net ? Pin
AspDotNetDev22-Jun-11 11:10
protectorAspDotNetDev22-Jun-11 11:10 
QuestionRemember sort order on paging for Datagrid Pin
vanikanc21-Jun-11 15:34
vanikanc21-Jun-11 15:34 
AnswerRe: Remember sort order on paging for Datagrid Pin
nainakarri21-Jun-11 20:30
nainakarri21-Jun-11 20:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.