/* 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();
}*/
答案 0 :(得分:1)
我不熟悉使用Crystal Reports的这种方式,但我可以看到你的ReportSource发生了一些奇怪的事情 - 你已经让ReportViewer指向了自己:
ReportViewer1.ReportSource = ReportViewer1;
不应该是这样的:
ReportViewer1.ReportSource = ds;