Loading

Load Crystal Sup Report in VS2008

Submitted by: 


Suppose you have namespace MoonSun.Solution.Report, and report rpt_StaffMovement that has 4 subreports name
1. NewStaff
2. Resignation
3. Termination
4. Transfer

You can use the following code
parameter DataSet dsStaffMovement has four tables

  1. public static void View_StaffMovement(DataSet dsStaffMovement)
  2. {
  3. try
  4. {
  5. MoonSun.Solution.Report.Rpt.rpt_StaffMovement rptDoc = new MoonSun.Solution.Report.Rpt.rpt_StaffMovement();
  6. rptDoc.OpenSubreport("NewStaff").Database.Tables[0].SetDataSource(dsStaffMovement.Tables[0]);
  7. rptDoc.OpenSubreport("Resignation").Database.Tables[0].SetDataSource(dsStaffMovement.Tables[1]);
  8. rptDoc.OpenSubreport("Termination").Database.Tables[0].SetDataSource(dsStaffMovement.Tables[2]);
  9. rptDoc.OpenSubreport("Transfer").Database.Tables[0].SetDataSource(dsStaffMovement.Tables[3]);
  10.  
  11. frm_RptDesign frmRptDesign = new frm_RptDesign();
  12. frmRptDesign.crView.ReportSource = rptDoc;
  13.  
  14. frmRptDesign.crView.Zoom(75);
  15. frmRptDesign.Show();
  16. }
  17. catch (Exception e)
  18. {
  19. MessageBox.Show(e.Message.ToString() + "," + e.StackTrace.ToString());
  20. }
  21. }



Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.