我想请问一下,当拖动这个控件到Default页面的时候,添加对象变量的代码,如:
private Array studentValues;
private ReportDocument studentObjectsReport;
以及编写的代码,如:
private void ConfigureCrystalReports()
{
PopulateStudentValuesArrayList();
string reportPath = Server.MapPath("CrystalReport.rpt");
studentObjectsReport = new ReportDocument();
studentObjectsReport.Load(reportPath);
studentObjectsReport.SetDataSource(studentValues);
myCrystalReportViewer.ReportSource = studentObjectsReport;
}
public void PopulateStudentValuesArrayList()
{
studentValues = new Array();
DateSet drStudent=StudentCls .GetStudent();
int i;
for (i = 0; i <= drStudent.Tables["student"].Rows.Count - 1; i++)
{
StudentCls s=new StudentCls (
Convert.ToInt32(drStudent.Tables["student"].Rows[i].ItemArray[0]),
Convert.ToString(drStudent.Tables["student"].Rows[i].ItemArray[1]),
Convert.ToInt32(drStudent.Tables["student"].Rows[i].ItemArray[2]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[3]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[4]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[5]));
studentValues.Add(s);
}}
protected void Page_Init(object sender,EventArgs e)
{
ConfigureCrystalReports();
}
是要放在哪个地方的呢?
我借了一本书是讲水晶报表的使用的,可是做到这一步,就不知道这些代码应该写在哪个地方,想请问一下有经验的人,谢谢!!对了我的开发语言是ASP.NTE的c#
private Array studentValues;
private ReportDocument studentObjectsReport;
以及编写的代码,如:
private void ConfigureCrystalReports()
{
PopulateStudentValuesArrayList();
string reportPath = Server.MapPath("CrystalReport.rpt");
studentObjectsReport = new ReportDocument();
studentObjectsReport.Load(reportPath);
studentObjectsReport.SetDataSource(studentValues);
myCrystalReportViewer.ReportSource = studentObjectsReport;
}
public void PopulateStudentValuesArrayList()
{
studentValues = new Array();
DateSet drStudent=StudentCls .GetStudent();
int i;
for (i = 0; i <= drStudent.Tables["student"].Rows.Count - 1; i++)
{
StudentCls s=new StudentCls (
Convert.ToInt32(drStudent.Tables["student"].Rows[i].ItemArray[0]),
Convert.ToString(drStudent.Tables["student"].Rows[i].ItemArray[1]),
Convert.ToInt32(drStudent.Tables["student"].Rows[i].ItemArray[2]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[3]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[4]),
Convert.ToDecimal(drStudent.Tables["student"].Rows[i].ItemArray[5]));
studentValues.Add(s);
}}
protected void Page_Init(object sender,EventArgs e)
{
ConfigureCrystalReports();
}
是要放在哪个地方的呢?
我借了一本书是讲水晶报表的使用的,可是做到这一步,就不知道这些代码应该写在哪个地方,想请问一下有经验的人,谢谢!!对了我的开发语言是ASP.NTE的c#
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货