private void frmRegistrationReport_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; frmStudentReport frm = new frmStudentReport(); rptRegistration rpt = new rptRegistration(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); UserRegistration_DBDataSet myDS = new UserRegistration_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from user_registration"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "User_Registration"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptRegistration rpt = new rptRegistration(); rpt.Site = this.Site; return(rpt); }