title: Crystal report is not showing data using Asp.net
body: <p>I am using Asp.net 4.0 and Sap crystal report my problem is that I am unable to show data on to the reportViewer after binding the dataset.</p>
  
  <p>Below is my Aspx designer code </p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="productRepot.aspx.cs" Inherits="ProductionPlanning1.productRepot" %&gt;
  
  &lt;%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral,    PublicKeyToken=692fbea5521e1304"
  Namespace="CrystalDecisions.Web" TagPrefix="CR" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
  &lt;/asp:Content&gt;
  
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
  
  &lt;asp:Label ID="prdt_Label1" runat="server" Text="ProductID"&gt;&lt;/asp:Label&gt;
  &lt;asp:TextBox ID="matrl_TextBox" runat="server"&gt;&lt;/asp:TextBox&gt;
  
  &lt;asp:Button ID="rpt_Button1" runat="server" Text="PrintProduct" 
      onclick="rpt_Button1_Click"&gt;&lt;/asp:Button&gt;
  &lt;CR:CrystalReportViewer ID="product_CrystalReportViewer1" runat="server" 
      AutoDataBind="true"&gt;&lt;/CR:CrystalReportViewer&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Product Report.aspx.cs </p>
  
  <pre><code>  protected void rpt_Button1_Click(object sender, EventArgs e)
      {
          //DataSet2 DS2 = new DataSet2();
          //Fyp_1.Product pp = new Fyp_1.Product();
          //DS2.Tables.Add(pp.GetProduct(Convert.ToInt16(matrl_TextBox.Text)).Copy());
          //DS2.Tables[0].TableName = "Product";
          //CrystalReportProduct TR = new CrystalReportProduct();
          //TR.SetDataSource(DS2);
          //product_CrystalReportViewer1.ReportSource = TR;
          //product_CrystalReportViewer1.DataBind();
  
          GenerateReport();
  
  
  
  
          //DataSet ds = new DataSet();
          //BookTicket_Class BT = new BookTicket_Class();
             //ds.Tables.Add(BT.GetBookTicketReport(Convert.ToInt16(TicketNO_TextBox.Text)).Copy());
          //ds.Tables[0].TableName = "BookTicket";
          //TicketReport TR = new TicketReport();
          //TR.SetDataSource(ds);
          //CrystalReportViewer1.ReportSource = TR;
          //CrystalReportViewer1.DataBind();
      }
  
      protected void GenerateReport()
      {
          SqlConnection sqlConn = new SqlConnection(@"Data Source=PROZECK-   PC\R2MSSQLSERVER;Initial Catalog=FYP;Integrated Security=True");
  
          SqlCommand comd;
          comd = new SqlCommand();
          comd.Connection = sqlConn;
          comd.CommandType = CommandType.StoredProcedure;
          comd.CommandText = "spgetproductNEW";
  
  
  
          comd.Parameters.Add("@MaterialID", SqlDbType.Int);
        //  int VAL = Convert.ToInt32(matrl_TextBox.Text);
          if (matrl_TextBox.Text.Trim() != "")
              comd.Parameters[0].Value = Convert.ToInt32(matrl_TextBox.Text);
          else
              comd.Parameters[0].Value = DBNull.Value;
  
  
  
  
          SqlDataAdapter sqlAdapter = new SqlDataAdapter();
          sqlAdapter.SelectCommand = comd;
  
          DataSet2 DS2 = new DataSet2();
          sqlAdapter.Fill(DS2, "Product");
  
          //oRpt.SetDataSource(ds);
  
          //CrystalReportViewer1.Visible = true;
  
          //CrystalReportViewer1.ReportSource = oRpt;
          CrystalReportProduct TR = new CrystalReportProduct();
          TR.SetDataSource(DS2);
          product_CrystalReportViewer1.ReportSource = TR;
         // product_CrystalReportViewer1.DataBind();
  
  
  
  
      }
  }
  </code></pre>
  
  <p>Below is the screenshot of the problem is described to you .</p>
  
  <p><img src="https://i.stack.imgur.com/yC7s5.png" alt="enter image description here"></p>
  
  <p>But when I check the data in  crystal report designer it show the data 
  <img src="https://i.stack.imgur.com/yIIO0.png" alt="enter image description here"></p>
  
  <p>My FIRST code of binding the data was this then i  changed it in to the above code i paste</p>
  
  <pre><code>        DataSet2 DS2 = new DataSet2();
          Fyp_1.Product pp = new Fyp_1.Product();
          DS2.Tables.Add(pp.GetProduct(Convert.ToInt16(matrl_TextBox.Text)).Copy());
          DS2.Tables[0].TableName = "Product";
          CrystalReportProduct TR = new CrystalReportProduct();
          TR.SetDataSource(DS2);
          product_CrystalReportViewer1.ReportSource = TR;
          product_CrystalReportViewer1.DataBind();
  </code></pre>