S
sean
Hi There,
I am storing images in SQL server ans trying to retrieve them into an image
control but I can't seem to get the image to show. If I load the image page
(ReadRealImage) on it's own it works no problem, what I am trying to do is
to load the image into a user control page with an image control on it.. The
querystring variable has a corresponding ListingID in the database.
Could someone help me out with the syntax please!
Sean
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
Dim strImageID as Integer = Request.QueryString("ListingID")
End If
End Sub
Function FormatURL(strImageID) as Integer
Return
("../ReadRealImage.aspx?ListingID=" & strImageID)
End Function
</script>
</head>
<tr valign="top"><td width="220">
<asp:Image Width="200" Height="200" alt="Listing Image" ImageUrl='<%#
FormatURL(strImageID) %>' Runat=server />
</td>
<td width="270">
</td></tr>
!--- code for image page
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim strImageID as Integer =
Request.QueryString("ListingID")
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlCommand("Select
ListingImageType, ListingImage from tblListings Where ListingID=" &
strImageID, myConnection)
Try
myConnection.Open()
Dim myDataReader as
SqlDataReader
myDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While
(myDataReader.Read())
Response.BinaryWrite(myDataReader.Item("ListingImage"))
'Response.BinaryWrite(myDataReader.Item("ListingImageType"))
Loop
myConnection.Close()
Response.Write("image
displayed")
Catch SQLexc As SqlException
Response.Write("Read Failed
: " & SQLexc.ToString())
End Try
End Sub
I am storing images in SQL server ans trying to retrieve them into an image
control but I can't seem to get the image to show. If I load the image page
(ReadRealImage) on it's own it works no problem, what I am trying to do is
to load the image into a user control page with an image control on it.. The
querystring variable has a corresponding ListingID in the database.
Could someone help me out with the syntax please!
Sean
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
Dim strImageID as Integer = Request.QueryString("ListingID")
End If
End Sub
Function FormatURL(strImageID) as Integer
Return
("../ReadRealImage.aspx?ListingID=" & strImageID)
End Function
</script>
</head>
<tr valign="top"><td width="220">
<asp:Image Width="200" Height="200" alt="Listing Image" ImageUrl='<%#
FormatURL(strImageID) %>' Runat=server />
</td>
<td width="270">
</td></tr>
!--- code for image page
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim strImageID as Integer =
Request.QueryString("ListingID")
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlCommand("Select
ListingImageType, ListingImage from tblListings Where ListingID=" &
strImageID, myConnection)
Try
myConnection.Open()
Dim myDataReader as
SqlDataReader
myDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While
(myDataReader.Read())
Response.BinaryWrite(myDataReader.Item("ListingImage"))
'Response.BinaryWrite(myDataReader.Item("ListingImageType"))
Loop
myConnection.Close()
Response.Write("image
displayed")
Catch SQLexc As SqlException
Response.Write("Read Failed
: " & SQLexc.ToString())
End Try
End Sub