Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-07-08
4
Medium Priority
?
249 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

Independent Software Vendors: 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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Loops Section Overview
Suggested Courses

610 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