Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cust_bill rpt = new cust_bill();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void Bill_Load(object sender, EventArgs e)
        {
            SqlConnection sqlcon  = new SqlConnection();
            SqlCommand    sqlcomm = new SqlCommand();

            try
            {
                cust_bill bill_report = new cust_bill();
                sqlcon = new SqlConnection(ConfigurationSettings.AppSettings["photostudioConnectionString"].ToString());
                sqlcon.Open();
                sqlcomm             = new SqlCommand();
                sqlcomm.Connection  = sqlcon;
                sqlcomm.CommandType = CommandType.StoredProcedure;
                sqlcomm.CommandText = "bill_cust_select";
                sqlcomm.Parameters.Add(new SqlParameter("@cust_id", SqlDbType.Int, 4));
                sqlcomm.Parameters["@cust_id"].Value = c_id;
                SqlDataAdapter dta = new SqlDataAdapter(sqlcomm);
                DataSet        ds  = new DataSet();
                dta.Fill(ds, "table");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No data Found", "CrystalReportWithOracle");
                    return;
                }
                bill_report.SetDataSource(ds.Tables[0]);
                cust_bill_crystalreportviewer.ReportSource = bill_report;
                sqlcon.Close();
                sqlcon.Dispose();
            }
            catch
            {
            }
            finally
            {
                sqlcon.Close();
                sqlcon.Dispose();
            }
        }