After binding gridview with crystal report…i am getting error report has no tables












2














I want to pass gridview data to blank crystal report.but i am getting
error "report has no tables"
i have used a button on which crystal report is to be viewed.
kindly help me
i have attached the code below:-



namespace Test
{
public partial class Test : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationSettings.AppSettings["constr"].ToString());
DataTable dt = new DataTable();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetDegreeName();
}
}

public void GetDegreeName()
{
try
{
objlog.Action = "SelectDegree";
objlog.StrName = "Sp_records";
dt = SchoolMarksheet_DataLayer.GetData(objlog);
drpdegreelist.DataSource = dt;
drpdegreelist.Items.Clear();
drpdegreelist.DataTextField = "Degree_Name";
drpdegreelist.DataBind();
drpdegreelist.Items.Insert(0, new ListItem("---Select Degree---
", "0"));
}
catch (Exception ex)
{

}
}

public void bscitclasswise()
{
try
{
objlog.Action = "DisplayRecords";
objlog.StrName = "Sp_records";
objlog.Degree_Id = drpdegreelist.SelectedIndex;
dt = SchoolMarksheet_DataLayer.GetData(objlog);

if (dt.Rows.Count > 0)
{

Gridview.DataSource = dt;
Gridview.DataBind();

ds.Tables.Add(dt);

}
}

catch (Exception ex)
{

}
}

protected void btnprint_Click(object sender, EventArgs e)
{
// for viewing crystal report on button click
try
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new
CrystalDecisions.CrystalReports.Engine.ReportDocument();
rd.FileName = Server.MapPath("~/Report.rpt");
rd.SetDataSource(dt);

CrystalReportViewer1.ReportSource= rd;
CrystalReportViewer1.DataBind();
}
catch(Exception ex)
{

}
}
}
}


And how can i print this crystal report on paper?










share|improve this question





























    2














    I want to pass gridview data to blank crystal report.but i am getting
    error "report has no tables"
    i have used a button on which crystal report is to be viewed.
    kindly help me
    i have attached the code below:-



    namespace Test
    {
    public partial class Test : System.Web.UI.Page
    {
    SqlConnection con = new
    SqlConnection(ConfigurationSettings.AppSettings["constr"].ToString());
    DataTable dt = new DataTable();
    DataSet ds = new DataSet();
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    GetDegreeName();
    }
    }

    public void GetDegreeName()
    {
    try
    {
    objlog.Action = "SelectDegree";
    objlog.StrName = "Sp_records";
    dt = SchoolMarksheet_DataLayer.GetData(objlog);
    drpdegreelist.DataSource = dt;
    drpdegreelist.Items.Clear();
    drpdegreelist.DataTextField = "Degree_Name";
    drpdegreelist.DataBind();
    drpdegreelist.Items.Insert(0, new ListItem("---Select Degree---
    ", "0"));
    }
    catch (Exception ex)
    {

    }
    }

    public void bscitclasswise()
    {
    try
    {
    objlog.Action = "DisplayRecords";
    objlog.StrName = "Sp_records";
    objlog.Degree_Id = drpdegreelist.SelectedIndex;
    dt = SchoolMarksheet_DataLayer.GetData(objlog);

    if (dt.Rows.Count > 0)
    {

    Gridview.DataSource = dt;
    Gridview.DataBind();

    ds.Tables.Add(dt);

    }
    }

    catch (Exception ex)
    {

    }
    }

    protected void btnprint_Click(object sender, EventArgs e)
    {
    // for viewing crystal report on button click
    try
    {
    CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new
    CrystalDecisions.CrystalReports.Engine.ReportDocument();
    rd.FileName = Server.MapPath("~/Report.rpt");
    rd.SetDataSource(dt);

    CrystalReportViewer1.ReportSource= rd;
    CrystalReportViewer1.DataBind();
    }
    catch(Exception ex)
    {

    }
    }
    }
    }


    And how can i print this crystal report on paper?










    share|improve this question



























      2












      2








      2







      I want to pass gridview data to blank crystal report.but i am getting
      error "report has no tables"
      i have used a button on which crystal report is to be viewed.
      kindly help me
      i have attached the code below:-



      namespace Test
      {
      public partial class Test : System.Web.UI.Page
      {
      SqlConnection con = new
      SqlConnection(ConfigurationSettings.AppSettings["constr"].ToString());
      DataTable dt = new DataTable();
      DataSet ds = new DataSet();
      protected void Page_Load(object sender, EventArgs e)
      {
      if (!IsPostBack)
      {
      GetDegreeName();
      }
      }

      public void GetDegreeName()
      {
      try
      {
      objlog.Action = "SelectDegree";
      objlog.StrName = "Sp_records";
      dt = SchoolMarksheet_DataLayer.GetData(objlog);
      drpdegreelist.DataSource = dt;
      drpdegreelist.Items.Clear();
      drpdegreelist.DataTextField = "Degree_Name";
      drpdegreelist.DataBind();
      drpdegreelist.Items.Insert(0, new ListItem("---Select Degree---
      ", "0"));
      }
      catch (Exception ex)
      {

      }
      }

      public void bscitclasswise()
      {
      try
      {
      objlog.Action = "DisplayRecords";
      objlog.StrName = "Sp_records";
      objlog.Degree_Id = drpdegreelist.SelectedIndex;
      dt = SchoolMarksheet_DataLayer.GetData(objlog);

      if (dt.Rows.Count > 0)
      {

      Gridview.DataSource = dt;
      Gridview.DataBind();

      ds.Tables.Add(dt);

      }
      }

      catch (Exception ex)
      {

      }
      }

      protected void btnprint_Click(object sender, EventArgs e)
      {
      // for viewing crystal report on button click
      try
      {
      CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new
      CrystalDecisions.CrystalReports.Engine.ReportDocument();
      rd.FileName = Server.MapPath("~/Report.rpt");
      rd.SetDataSource(dt);

      CrystalReportViewer1.ReportSource= rd;
      CrystalReportViewer1.DataBind();
      }
      catch(Exception ex)
      {

      }
      }
      }
      }


      And how can i print this crystal report on paper?










      share|improve this question















      I want to pass gridview data to blank crystal report.but i am getting
      error "report has no tables"
      i have used a button on which crystal report is to be viewed.
      kindly help me
      i have attached the code below:-



      namespace Test
      {
      public partial class Test : System.Web.UI.Page
      {
      SqlConnection con = new
      SqlConnection(ConfigurationSettings.AppSettings["constr"].ToString());
      DataTable dt = new DataTable();
      DataSet ds = new DataSet();
      protected void Page_Load(object sender, EventArgs e)
      {
      if (!IsPostBack)
      {
      GetDegreeName();
      }
      }

      public void GetDegreeName()
      {
      try
      {
      objlog.Action = "SelectDegree";
      objlog.StrName = "Sp_records";
      dt = SchoolMarksheet_DataLayer.GetData(objlog);
      drpdegreelist.DataSource = dt;
      drpdegreelist.Items.Clear();
      drpdegreelist.DataTextField = "Degree_Name";
      drpdegreelist.DataBind();
      drpdegreelist.Items.Insert(0, new ListItem("---Select Degree---
      ", "0"));
      }
      catch (Exception ex)
      {

      }
      }

      public void bscitclasswise()
      {
      try
      {
      objlog.Action = "DisplayRecords";
      objlog.StrName = "Sp_records";
      objlog.Degree_Id = drpdegreelist.SelectedIndex;
      dt = SchoolMarksheet_DataLayer.GetData(objlog);

      if (dt.Rows.Count > 0)
      {

      Gridview.DataSource = dt;
      Gridview.DataBind();

      ds.Tables.Add(dt);

      }
      }

      catch (Exception ex)
      {

      }
      }

      protected void btnprint_Click(object sender, EventArgs e)
      {
      // for viewing crystal report on button click
      try
      {
      CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new
      CrystalDecisions.CrystalReports.Engine.ReportDocument();
      rd.FileName = Server.MapPath("~/Report.rpt");
      rd.SetDataSource(dt);

      CrystalReportViewer1.ReportSource= rd;
      CrystalReportViewer1.DataBind();
      }
      catch(Exception ex)
      {

      }
      }
      }
      }


      And how can i print this crystal report on paper?







      c# crystal-reports






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 3:28









      e_i_pi

      2,51521632




      2,51521632










      asked Nov 21 at 3:00









      Meetali

      111




      111





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404680%2fafter-binding-gridview-with-crystal-report-i-am-getting-error-report-has-no-ta%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404680%2fafter-binding-gridview-with-crystal-report-i-am-getting-error-report-has-no-ta%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen