Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptFamilyCard rpt = new rptFamilyCard();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
0
        private void rpt_Area()
        {
            try
            {
                if (cmbSearch.Text == "")
                {
                    MessageBox.Show("Please Fill in the Field!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {
                    string X = cmbSearch.Text;


                    SqlConnection conn = new SqlConnection(Community.DBLayer.con_String);

                    conn.Open();

                    SqlCommand cmd = new SqlCommand("Select * from tblFamily WHERE Area = '" + X + "'Order By tblFamily.FCardNo asc", conn);


                    DataTable dt = new DataTable();

                    cmd.CommandType = CommandType.Text;

                    //SqlParameter paraID = cmd.Parameters.Add("@FCardNo",SqlDbType.VarChar , 50);

                    //paraID.Value = X;

                    SqlDataAdapter da = new SqlDataAdapter();

                    da.SelectCommand = cmd;

                    da.Fill(dt);


                    Reports.Family_Card.frmViewer     frm = new frmViewer();
                    Reports.Family_Card.rptFamilyCard rpt = new rptFamilyCard();

                    frm.crystalReportViewer1.ReportSource = rpt;


                    rpt.SetDataSource(dt);
                    rpt.SetParameterValue("Filter", "Family Cards of Area '" + X + "'");

                    frm.Show();

                    conn.Close();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("AN unknown error occured \n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }