Dynamically add Image on crystal report vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • heemanshubhalla
    New Member
    • Oct 2013
    • 4

    Dynamically add Image on crystal report vb.net

    I am working on project . I have to Retrieve image from Database Table (table 1) . Image is stored in Image data-type in table 1 . Then i have to put this image on crystal report. I have searched a lot for this topic but not successfully completed this task.

    Actually i want to retrieve the employee details along with their images from database and get all on crystal report

    I am using :-
    vs 2010
    SAP crystal reports 13
    using vb or c#

    Here is code that i am using :
    Code:
    Dim con As New SqlConnection("Data Source=HB-6F0B5AC76D8E;Initial Catalog=putimage;Integrated Security=True")
            con.Open()
            Dim cmd As New SqlCommand("select * from table1", con)
            Dim da As New SqlDataAdapter
            da.SelectCommand = cmd
            Dim ds As New DataSet
            da.Fill(ds)
            Dim a As Byte() = ds.Tables(0).Rows(0).Item(0)
            Dim b = ds.Tables(0).Rows(0).Item(0)
            Dim ms As New System.IO.MemoryStream(a)
            Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(ms)
            Dim dt As New DataTable
            dt.Columns.Add("pic")
            dt.Rows.Add(b)
    
            'rpt.Load("S:\vb & vb.net\project done\WindowsApplication3\WindowsApplication3\CrystalReport1.rpt")
            'rpt.SetDataSource(dt)
            'Form2.CrystalReportViewer1.ReportSource = rpt
            '  Form2.Show()
    
            PictureBox1.Image = img
            MsgBox("DONE")
            
            cmd.Dispose()
            con.Dispose()
Working...