public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crBaoCao rpt = new crBaoCao();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void btnLoc_Click(object sender, EventArgs e)
        {
            SqlConnection con = dal.GetConnect();

            con.Open();
            string         sql = "select *from SinhVien where MaLop=@MaLop";
            SqlDataAdapter da  = new SqlDataAdapter(sql, con);

            da.SelectCommand.Parameters.AddWithValue("@MaLop", cmbMaLop.SelectedValue.ToString());
            DataTable dt = new DataTable();

            da.Fill(dt);
            crBaoCao       cr = new crBaoCao();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            crConnectionInfo.ServerName   = "Ty-PC";
            crConnectionInfo.DatabaseName = "CNPM_1";
            crConnectionInfo.UserID       = "sa";
            crConnectionInfo.Password     = "******";
            TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in cr.Database.Tables)
            {
                TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
                crTableLogonInfo.TableName      = table.Name;
                crTableLogonInfo.ConnectionInfo = crConnectionInfo;
                crTableLogonInfos.Add(crTableLogonInfo);
                table.ApplyLogOnInfo(crTableLogonInfo);
            }
            crvHocKyHocPhan.LogOnInfo = crTableLogonInfos;
            cr.SetDataSource(dt);
            ParameterValues        a = new ParameterValues();
            ParameterDiscreteValue b = new ParameterDiscreteValue();

            b.Value = cmbMaLop.SelectedValue.ToString();
            a.Add(b);
            cr.DataDefinition.ParameterFields["txtMaLop"].ApplyCurrentValues(a);
            crvHocKyHocPhan.ReportSource = cr;
            crvHocKyHocPhan.Show();
        }