preliminary:
1.modify web.config accrding to the article
2. add reference to dynamicimage.dll
the code:
Private Sub GetCustomer(ByVal eid As Integer)
Dim cn As New SqlConnection(strcn)
cn.Open()
Dim cm As New SqlCommand("select * from employees where employeeid = " &
eid, cn)
cm.CommandType = CommandType.Text
Dim rd As SqlDataReader = cm.ExecuteReader(CommandBehavior.CloseConnection)
If rd.Read Then
If Not IsDBNull(rd("photo")) Then
Dim img As Byte() = CType(rd("photo"), Byte())
Dim ms As New MemoryStream(img, 78, img.Length - 78)
DynamicImage1.ImageBytes = ms.ToArray()
End If
End If
rd.Close()
cm.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
GetCustomer(1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
GetCustomer(2)
End Sub
questions:
1. when i click button1, the image from customer with id = 1, display in the
web, then i click button2, but image of customer with id = 2 doesn't appear
.. why ?
2. how to use openfiledialog in asp.net ?
thanks,