我的要求是在水晶報告中,通過一次單擊生成/打印特定課程的所有學生的標記表。環形印刷水晶報告
當我用For循環話,就說明報告中只有最後一個記錄/頁。
,我的代碼是
私人無效btnGenerate_Click(對象發件人,EventArgs的){
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!");
}
}
我怎麼可以追加多marksheet一次,然後一次打印出來?