crystal report problem

how to display crystal report

Page 1 of 1

0 Replies - 1065 Views - Last Post: 17 February 2009 - 07:57 AM Rate Topic: -----

#1 daniel50096230  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 15-May 08

crystal report problem

Posted 17 February 2009 - 07:57 AM

I had the following code to display crystal report based on the sql.



 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		
		conKk.Open()
	   
		Dim strReportPath As String = "C:\Documents and Settings\Chee Mun\Desktop\FYPvb\FYP\CrystalReport1.rpt"
		MessageBox.Show(strReportPath)
		Dim mySelect As SqlCommand

		mySelect = New SqlCommand("Select * from Song", conKk)

		Dim mySqlDataAdapter As New SqlDataAdapter(mySelect)

		Dim mydsSong As New DataSet

		mySqlDataAdapter.Fill(mydsSong, "Song")
		Dim objRpt As New ReportDocument
		objRpt.Load(strReportPath)

		objRpt.SetDataSource(mydsSong.Tables("Song"))
		CrystalReportViewer1.ShowRefreshButton = False
		CrystalReportViewer1.ShowCloseButton = False
		CrystalReportViewer1.ShowGroupTreeButton = False

		CrystalReportViewer1.ReportSource = objRpt
		CrystalReportViewer1.Refresh()
		conKk.Close()
	End Sub



But the problem occured in objRpt.SetDataSource(mydsSong.Tables("Song")),it stated that no tables is found but my database is having this table.

anyone could guide me?


I appreciate it.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1