Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: error that says "The report has no tables". Post Reply Post New Topic
Author Message
eswaran
Newbie
Newbie
Avatar

Joined: 08 Dec 2008
Location: India
Online Status: Offline
Posts: 1
Quote eswaran Replybullet Topic: error that says "The report has no tables".
    Posted: 08 Dec 2008 at 4:36am

  Hi all,

I am developing windows application. In this application I need to use the crystal report. I need to add the fields by programmatically. I am using dataset to bind the table values with crystal report. But when I set the datasource value to the crystalreport i am getting error that says "The report has no table". How to solve this? Here, I attached my code.

private void Form1_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();
            con.ConnectionString = databaseconnectionstring;

           StringBuilder sbSql = new StringBuilder();
            sbSql.Append("SELECT ");
            sbSql.Append("Face_page.[Case], Face_page.Type, Face_page.Location, Face_page.Flag, ");
            sbSql.Append("Face_page.Officer, Face_page.ID, Face_page.Written, Face_page.Shift, ");
            sbSql.Append("Face_page.DaysOff ");           
            sbSql.Append("FROM ");
            sbSql.Append(" Face_page ");           
            sbSql.Append(" where ");
            sbSql.Append("Face_page.[Case] = '71-111-1111E'");

            string sql = sbSql.ToString();
            DataSet ds = new DataSet();         
                       
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
           
            da.Fill(ds, "sample");          

            CrystalReport4 cryReport1 = new CrystalReport4();          
           
            if(ds.Tables.Count>0) {
                cryReport1.SetDataSource(ds.Tables[0]); // ----> I am getting error here..
            }
            crystalReportViewer1.Visible = true;
            this.crystalReportViewer1.ReportSource = cryReport1;
            con.Close();
        }

R. Eswaran
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.