Display Image to Crystal Report

Display Image to Crystal Report from access database.

Page 1 of 1

1 Replies - 8586 Views - Last Post: 03 March 2010 - 12:38 AM Rate Topic: -----

#1 j0e  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 46
  • Joined: 01-June 08

Display Image to Crystal Report

Posted 03 February 2010 - 01:33 AM

Hello,

I am building a small project that saves some data about persons including their photo. I am using access database for portability reasons. I created a crystal report that i want to use to display the data of a person as a print feature.

This is the code that generates the crystal report.

Private Sub Button9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Form9.Show()

        Dim ds As New DataSet1
        Dim cnn As OleDbConnection
        Dim connectionString As String
        Dim sql As String

        connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\Database.mdb; Jet OLEDB:Database Password=;"
        cnn = New OleDbConnection(connectionString)
        cnn.Open()
        sql = "SELECT eponimo, onoma, Photo FROM ImageTable"
        Dim dscmd As New OleDbDataAdapter(sql, cnn)
        dscmd.Fill(ds, "ImageTable")
        MsgBox(ds.Tables(1).Rows.Count)
        cnn.Close()

        Dim objRpt As New CrystalReport1
        objRpt.SetDataSource(ds.Tables(1))
        Form9.CrystalReportViewer1.ReportSource = objRpt
        Form9.CrystalReportViewer1.Refresh()

    End Sub



My problem is that i dont know how to get the photo from the database and display it in the crystal report. I dont want to do it using the wizard because later i want to show only a specific photo of the choosen person and not all the photos.

Any idea how can i take the photo and put it in the place i want in the crystal report?

Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Display Image to Crystal Report

#2 Guest_ravi*


Reputation:

Re: Display Image to Crystal Report

Posted 03 March 2010 - 12:38 AM

View Postj0e, on 03 February 2010 - 12:33 AM, said:

Hello,

I am building a small project that saves some data about persons including their photo. I am using access database for portability reasons. I created a crystal report that i want to use to display the data of a person as a print feature.

This is the code that generates the crystal report.

Private Sub Button9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Form9.Show()

        Dim ds As New DataSet1
        Dim cnn As OleDbConnection
        Dim connectionString As String
        Dim sql As String

        connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\Database.mdb; Jet OLEDB:Database Password=;"
        cnn = New OleDbConnection(connectionString)
        cnn.Open()
        sql = "SELECT eponimo, onoma, Photo FROM ImageTable"
        Dim dscmd As New OleDbDataAdapter(sql, cnn)
        dscmd.Fill(ds, "ImageTable")
        MsgBox(ds.Tables(1).Rows.Count)
        cnn.Close()

        Dim objRpt As New CrystalReport1
        objRpt.SetDataSource(ds.Tables(1))
        Form9.CrystalReportViewer1.ReportSource = objRpt
        Form9.CrystalReportViewer1.Refresh()

    End Sub



My problem is that i dont know how to get the photo from the database and display it in the crystal report. I dont want to do it using the wizard because later i want to show only a specific photo of the choosen person and not all the photos.

Any idea how can i take the photo and put it in the place i want in the crystal report?

Thanks in advance!

Was This Post Helpful? 0

Page 1 of 1