0
Answer

the report has no tables error in crystal reports in vb.net

Danish Habib

Danish Habib

9y
831
1
I have created a stored procedure to bind a report for purposes i have a data set and in which i have datatable when using the below code i open the report it says "THE REPORT HAS NO TABLES "
Private Function GetData() As CDFSetDetailed
Dim constring As String = ConfigurationManager.ConnectionStrings("ConnStringDb1").ConnectionString
Dim cmd As SqlCommand = New SqlCommand("usp_Target_AchieveThirdFinal")
Dim con As SqlConnection = New SqlConnection(constring)
Dim sda As SqlDataAdapter = New SqlDataAdapter
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
sda.SelectCommand = cmd
cmd.Parameters.Add("@QuarterID", SqlDbType.TinyInt).Value = Integer.Parse(ddlQuarter.SelectedValue)
cmd.Parameters.Add("@YearID", SqlDbType.TinyInt).Value = Integer.Parse(ddlyear.SelectedValue)
cmd.Parameters.Add("@DistrictID", SqlDbType.TinyInt).Value = Integer.Parse(ddlDistrict.SelectedValue)
cmd.Parameters.Add("@QuestionID", SqlDbType.TinyInt).Value = Integer.Parse(ddlIndicators.SelectedValue)
Using dsCustomers As New CDFSetDetailed()
sda.Fill(dsCustomers, "DataTable1")
Return dsCustomers
End Using
' sda.Fill(DsCdf, "DataTable1")
' Return DsCdf
End Function
Protected Sub btnReport_Click(sender As Object, e As EventArgs) Handles btnReport.Click
Dim crystalReport As New ReportDocument()
crystalReport.Load(Server.MapPath("~/DetailReport.rpt"))
Dim dsCustomers As CDFSetDetailed = GetData()
crystalReport.SetDataSource(dsCustomers)
CrystalReportViewer1.ReportSource = crystalReport
End Sub