我的要求是在水晶报表中单击生成/打印特定班级所有学生的评分表。
当我使用 For 循环时,它只显示报告的最后一条记录/页面。
并且我的代码是
私人无效btnGenerate_Click(对象发送者,EventArgs e){
try
{
axCrystalActiveXReportViewer1.ReportSource = null;
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
crConnectionInfo.ServerName = Configuration.ServerName;
crConnectionInfo.DatabaseName = Configuration.DataBaseName;
crConnectionInfo.UserID = Configuration.Server_userName;
crConnectionInfo.Password = Configuration.Server_password;
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
for(int i=0; i<=x; i++)
{
DataSet ds_ViewTermMarkSheet = new DataSet();
Hashtable htViewTermMarkSheet = new Hashtable();
htViewTermMarkSheet.Add("@Year", txtYear.Text);
htViewTermMarkSheet.Add("@Faculty", cboFaculty.Text);
htViewTermMarkSheet.Add("@Level", cboClass.Text);
htViewTermMarkSheet.Add("@Section", cboSection.Text);
htViewTermMarkSheet.Add("@term", cboTerm.Text);
htViewTermMarkSheet.Add("@CRN",.ToString());
DbOperations _dbAccess = new DbOperations();
_dbAccess.selectStoredProcedure(ds_ViewTermMarkSheet, "spSelectExamView_Exam_TermWiseMarkSheet", htViewTermMarkSheet, "Marks");
cryRpt.SetDataSource(ds_ViewTermMarkSheet.Tables["Marks"]);
}
axCrystalActiveXReportViewer1.Refresh();
cryRpt.Close();
}
catch (Exception ex)
{
MessageBox.Show("Mark Sheet generation was not successful.\r" + ex.Message, "Error!");
}
}
我怎样才能一次附加多个标记表并一次打印它们?