-
November 25th, 2009, 07:59 PM
#1
VB.NEt web display image
I has the following code in my vb.net:
Code:
Dim sql2 As String = " SELECT * FROM Etiqa_Image_Details where TransmissionID='" & Request("id") & "' "
With objDB.OpenDataReader(sql2)
While .Read()
If .Item("ImageType") = "Invoice" Then
imgInv.ImageUrl = .Item("ImagePath")
Session.Item("InvImage") = .Item("ImageID")
lbl.Text = "<img src=""" + .Item("ImagePath") + """ />"
End If
If .Item("ImageType") = "Payment" Then
imgPay.ImageUrl = .Item("ImagePath")
Session.Item("PayImage") = .Item("ImageID")
Response.ContentType = (.Item("ImagePath"))
Response.BinaryWrite(.Item("ImagePath"))
End If
End While
End With
However,i get this error while retrieving the image path(Varchar in sql server 2000) and display the image on the web.
Unable to cast object of type 'System.String' to type 'System.Byte[]'.
Anyone help??
-
November 26th, 2009, 01:12 AM
#2
Re: VB.NEt web display image
try
Code:
imgInv.ImageUrl=Image.FromFile("ImagePath")
-
November 26th, 2009, 02:56 AM
#3
Re: VB.NEt web display image
Hi, I am not able to find .FromFile method from Vb.net web application...
-
November 26th, 2009, 02:59 AM
#4
Re: VB.NEt web display image
I get this error:
Value of type 'System.Drawing.Image' cannot be converted to 'String'.
-
November 26th, 2009, 09:48 PM
#5
Re: VB.NEt web display image
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|