Sir i am not able to create an object of my crystal report page in .aspx page(the one which is having crystal report viewer in it).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
public partial class cr : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
DataSet1 ds=new DataSet1();
SqlDataAdapter adapter=new SqlDataAdapter("SELECT UserName, WardNo, Password, ElectionId, Day, Month, Year, Gender, EmailId, Address FROM dbo.users",con);
adapter.Fill(ds.viewcan);
CrystalReport report=new CrystalReport();
report.SetDataSource(ds);
CrystalReportViewer1.ReportSource=report;
}
}
the above code is giving following error
The report has no tables.
Exception Details: CrystalDecisions.CrystalReports.Engine.DataSourceException: The report has no tables.
Source Error:
Line 19: // CrystalReport report=new CrystalReport(); Line 20: CrystalReport report = new CrystalReport(); Line 21: report.SetDataSource(ds); Line 22: CrystalReportViewer1.ReportSource=report; Line 23: }
|