Click here to Skip to main content
15,912,897 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to open pdf in the new tab or new browser? Pin
Dhyanga28-Jun-11 8:40
Dhyanga28-Jun-11 8:40 
GeneralRe: how to open pdf in the new tab or new browser? Pin
Parwej Ahamad28-Jun-11 8:45
professionalParwej Ahamad28-Jun-11 8:45 
GeneralRe: how to open pdf in the new tab or new browser? Pin
Dhyanga28-Jun-11 8:59
Dhyanga28-Jun-11 8:59 
AnswerRe: how to open pdf in the new tab or new browser? Pin
Vasudevan Deepak Kumar30-Jun-11 14:08
Vasudevan Deepak Kumar30-Jun-11 14:08 
QuestionFormatting data in a GridView Pin
mjackson1124-Jun-11 8:25
mjackson1124-Jun-11 8:25 
AnswerRe: Formatting data in a GridView Pin
thatraja24-Jun-11 8:54
professionalthatraja24-Jun-11 8:54 
GeneralRe: Formatting data in a GridView Pin
mjackson1124-Jun-11 9:36
mjackson1124-Jun-11 9:36 
AnswerRe: Formatting data in a GridView Pin
mjackson1125-Jun-11 9:46
mjackson1125-Jun-11 9:46 
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 

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.