コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || comboBox1.Text == "")
            {
                MessageBox.Show("You left empty fields.Fill up all information.", "error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter();
                    da.SelectCommand = new SqlCommand("execute salesDateWise @itemCode,@date", con);
                    da.SelectCommand.Parameters.AddWithValue("@itemCode", comboBox1.Text);
                    da.SelectCommand.Parameters.AddWithValue("@date", textBox1.Text);
                    DataTable dt = new DataTable();
                    da.Fill(dt);

                    SalesItemBalDAte myreport = new SalesItemBalDAte();
                    myreport.SetDataSource(dt);
                    saleItemBalDAteView sibdv = new saleItemBalDAteView();
                    sibdv.crystalReportViewer1.ReportSource = myreport;
                    sibdv.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    con.Close();
                }
            }
        }
コード例 #2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            SalesItemBalDAte rpt = new SalesItemBalDAte();

            rpt.Site = this.Site;
            return(rpt);
        }