Hi,
See the Below codes, it may help for you.
.aspx Part
<asp:TemplateColumn HeaderText="Image">
<ItemTemplate>
<asp:Image
Width="150" Height="125"
ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "ImageID")) %>'
Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
.vb Part
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim strImageID as String = Request.QueryString("id")
' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Dim myCommand As New SqlCommand("Select ImageType, Image from real_images Where ImageID=" & strImageID, myConnection)
' I have used the select statement. But it would be much much better, if you
'could write a small stored procedure which contains the above sql statement.
' Mark the Command as a SPROC (in case, if you wrote the stored procedure
'myCommand.CommandType = CommandType.StoredProcedure
Try
myConnection.Open()
Dim myDataReader as SqlDataReader
myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
Do While (myDataReader.Read())
Response.ContentType = myDataReader.Item("ImageType")
Response.BinaryWrite(myDataReader.Item("Image"))
Loop
myConnection.Close()
Catch SQLexc As SqlException
End Try
End Sub