views:

67

answers:

1
/* protected void Page_Load(object sender, EventArgs e)
{
      //--Sql string
    string strId1;
    strId1=Request["empid"].ToString();

    string strId2;
    strId2 = Request["empid1"].ToString();

    String strCmd = "";
    strCmd += "Select YKCODE,NAME,RNAME,TICODE,MADKBN,MKCODE,TANKBN,YOUKBN,KOUCODE ";
    strCmd += "From GMYAKU ";
    if(strId1!="" && strId2!="")
    {
    strCmd += "where YKCODE BETWEEN " + strId1 + " AND " + strId2;
    }

    //--Opening Sql Connection
    string strConn = ConfigurationManager.AppSettings["ConnectionString"];
    SqlConnection sqlConn = new SqlConnection(strConn);
    DataSet ds = new DataSet();
    SqlDataAdapter da = new SqlDataAdapter(strCmd, sqlConn);

    //--this statement is very important, here the table name should 
    //--match with the XML Schema table name 
    da.Fill(ds, "GMYAKU");

    //--Closing Sql Connection
    sqlConn.Close();

    //--(Optional) I have used it to disable the properties
    //CrystalReportViewer1.DisplayGroupTree = false;
    //CrystalReportViewer1.HasCrystalLogo = false;

    //--Initializing CrystalReport

   // ReportDocument myReportDocument;
    //myReportDocument = new ReportDocument();
   ReportViewer1.LocalReport("Report1.rdlc");


    //--Binding report with CrystalReportViewer
    ReportViewer1.ReportSource = ReportViewer1;
    ReportViewer1.DataBind(); 

}*/
+1  A: 

I'm not familiar with this way of using Crystal Reports, but I can see there's something odd happening with your ReportSource - you've got the ReportViewer pointing to itself:

ReportViewer1.ReportSource = ReportViewer1;

Shouldn't this be something like:

ReportViewer1.ReportSource = ds;
GenericMeatUnit