1

!!

I'm using crystal report in my project of vb.net. I'm using visual studio 2010,sql server2008 and SAP crystal report.there is an error that i can not overcome/solve.here is my code:

  Dim database As New Database
  Dim dr As DataRow
  Dim dt As Data.DataTable
  Dim report As New CrystalReportChalan
  Dim query1 As String
  Try
        query1 = "select per_name,f_name,per_address,rem_amount from person_info  "
        database.creatConn()
        dt = database.getDS(query1, "person_info")
        'dr = dt.Rows(0)
        MessageBox.Show(dt.Rows.Count)  // Here the no of rows displayed


        report.SetDataSource(dt)   //Error 'Report has no table'

        CrystalReportViewer1.ReportSource = report
        CrystalReportViewer1.Refresh()
Catch ex As Exception
        MessageBox.Show("Error: " & ex.Message)
End Try
  • there is a separated class for Database connection
  • that class has function to get data from database.
4

0 回答 0