hi,
I am going through this tutorial and i am stuck, here is my problem i can read the images from the db but it displays the same image(the first image inserted).
here is the code:
<script runat="server">
Public Sub Page_Load(sender As Object, e As EventArgs)
' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
Dim myCommand As New SqlCommand("Select * from Person", myConnection)
Try
myConnection.Open()
Dim myDataReader as SqlDataReader
myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While (myDataReader.Read())
Response.ContentType = myDataReader.Item("PersonImageType")
Response.BinaryWrite(myDataReader.Item("PersonImage"))
Loop
myConnection.Close()
Response.Write("Person info successfully retrieved!")
Catch SQLexc As SqlException
Response.Write("Read Failed : " & SQLexc.ToString())
End Try
End Sub
</script>
then i got a function:
Function FormatURL(ByVal strArgument) As String
Return ("readrealimage.aspx?id=" & strArgument)
End Function
which i call in my gridview:
<asp:TemplateColumn HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image1"
Width="150" Height="125"
ImageUrl='<%#FormatURL(DataBinder.Eval(Container.DataItem, "PersonID")) %>'
Runat=server />
any help would be appreciated.
thanks