Imports IBM.Data.Informix
Public Class ShowPicture
Inherits System.Web.UI.Page
Private Sub ShowPhoto(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Read in the employee ID from the querystring
Dim iEmployeeID
iEmployeeID = Request.QueryString("ID")
Dim conIfx As New IfxConnection
'Set Informix Connection String
conIfx.ConnectionString = "Server=yourserver;DataBase=yourdatabase;User Id=username;Host=dbhost;Protocol=onsoctcp;service=yourservice;Password=yourpassword;"
Dim strSQL As String
strSQL = _
"SELECT profile_rec.id, profile_rec.photo " & _
"FROM profile_rec " & _
"WHERE profile_rec.id='" & iEmployeeID & "'"
Dim cmdIfx As New IfxCommand(strSQL, conIfx)
'Open Informix Connection
conIfx.Open()
'Delcare Informix Data Reader
Dim drIfx As IfxDataReader
'Execute Informix Reader
drIfx = cmdIfx.ExecuteReader()
If drIfx.Read Then
Response.ContentType = "image/jpeg"
Response.BinaryWrite(drIfx.Item("photo"))
End If
'Clean up...
drIfx.Close()
drIfx = Nothing
conIfx.Close()
conIfx = Nothing
End Sub
End Class