Solved

How to retrieve an image from sql server database to an asp.net table control ?

Posted on 2009-07-08
4
247 Views
Last Modified: 2012-05-07
In my project I am using the following manner to retrieve the images from database ...

Private Sub GenerateTableData(ByVal orgid As Integer)
        Dim str As String
        Dim cmd As New SqlCommand
        Dim conn As New SqlConnection(connStr)
        conn.Open()
        str = "Select productid, productname from tblproduct WHERE originid=" & orgid
        Try
            cmd = New SqlCommand(str, conn)
            Dim dtr As New SqlDataAdapter(cmd)
            Dim dst As New DataSet
            dst.Clear()
            dtr.Fill(dst, "po")
            Dim tr As TableRow
            Dim td As TableCell
            Dim i, j As Integer
            For i = 0 To dst.Tables(0).Rows.Count - 1
                tr = New TableRow
                td = New TableCell
                td.Width = 167
                td.HorizontalAlign = HorizontalAlign.Center
                td.VerticalAlign = VerticalAlign.Middle
                Dim prodId As Integer = dst.Tables(0).Rows(i).Item(0)
                td.Text = "ABC" & "<asp:Image ID='Image" & i & "' runat='server' ImageUrl='imgGrab.aspx?tab=tblproduct&showfld=smallimage&condfld=productid&id=" & prodId & "' ImageAlign='middle' />"
                tr.Cells.Add(td)
                Table1.Rows.Add(tr)
            Next
        Catch ex As Exception
            Throw
        Finally
            conn.Close()
        End Try

My Output is :
ABC
ABC
(As only 2 records in the table)
But no image is showing in the table. If I copy paste the code of image control directly in the page it is showing the image. so i think my ImgGrab.aspx is working fine.
will you pls help me in this regard ???
its urgent ...
0
Comment
Question by:akulavi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 24801457
0
 

Author Comment

by:akulavi
ID: 24801470
I am following ur links... but it will be helpful for me if u pls rectify my code which i had already stated above...... because the same code if I am using in an image control it is showing me the image , but if I write the code as the text of of TableCell control then it is not showing ...
0
 

Author Comment

by:akulavi
ID: 24801478
Moreover, My requirement is very specific ..... whether we can use the tablecell's text as I had stated earlier or we cannot use the image control..... If yes then whether my way is ok or not ....
0
 

Accepted Solution

by:
akulavi earned 0 total points
ID: 24801698
I have solved my problem using the <img >control of html.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question