Greetings everyone,

I'm having a problem on displaying my picture on the image box. Instead it displays the picture on the image box, it opens a web page and displays it there.

Here's the code

 conn = New SqlConnection("Server=Jeiku-shin-pc;Database=EnrollmentDB;Trusted_Connection=True")
        Dim cmd As SqlCommand = New SqlCommand( _
                    "SELECT * FROM [Student Info] WHERE studentID = '" & _
                   studIDddl.Text & "' ", conn)
        conn.Open()
        Dim sdr As SqlDataReader = cmd.ExecuteReader()

        If (sdr.Read() = True) Then
            studLvlDDL.Text = sdr("studentLvl")
            studentSectionTB.Text = sdr("studentSection")
            firstNameTF.Text = sdr("firstName")
            miTF.Text = sdr("middleInitial")
            lastNameTF.Text = sdr("lastName")
            genderTB.Text = sdr("gender")
            bdayTB.Text = sdr("Birthdate")
            ageTB.Text = sdr("personAge")
            civilStatusDDL.Text = sdr("civilStatus")
            homeAddressTF.Text = sdr("homeAddress")
            telNoTF.Text = sdr("residenceNo")
            cellNoTF.Text = sdr("cellNo")
            motherNameTB.Text = sdr("motherName")
            motherOccupationTB.Text = sdr("occupationMother")
            fatherNameTB.Text = sdr("fatherName")
            fatherOccupationTB.Text = sdr("occupationFather")
            emergencyPersonTB.Text = sdr("emergencyPerson")
            emergencyPtelTB.Text = sdr("residenceTelEP")
            emergencyPcel.Text = sdr("cellNoEP")
            topDDL.Text = sdr("TypeOfPayment")
            'Image1 = sdr("PhotoFileName")
            Dim byteArray As Byte() = sdr("PhotoFileName")
            Response.ContentType = "image/jpeg"
            Response.BinaryWrite(byteArray)
        Else
        End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.