Beispiel #1
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            int    maod = int.Parse(txtMaOder.Text);;
            string mahd = cthdBO.layMaHD(maod);
            int    i    = 0;

            Int32.TryParse(mahd, out i);

            Report_HD objRpt = new Report_HD();

            objRpt.SetDataSource(rp.report_HD(i).Tables[1]);
            crystalReportViewer_HD.ReportSource = objRpt;
            crystalReportViewer_HD.Refresh();
        }
Beispiel #2
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            int    maod = int.Parse(txtMaOder.Text);;
            string mahd = cthdBO.layMaHD(maod);
            int    i    = 0;

            Int32.TryParse(mahd, out i);
            SqlConnection connect;

            connect = new SqlConnection(@"server=.\SQLEXPRESS; Database=QuanLiCaPhe;integrated security=true");
            connect.Open();
            SqlDataAdapter da    = new SqlDataAdapter();
            string         query = "SELECT MaHD,MaMon,TenMon,SoLuong,DonGia,ThanhTien FROM tblCTHoaDon where MaHD='" + i + "'";
            SqlDataAdapter dscm  = new SqlDataAdapter(query, connect);
            DSHoaDon       ds    = new DSHoaDon();

            dscm.Fill(ds, "tblCTHoaDon");
            connect.Close();
            Report_HD objRpt = new Report_HD();

            objRpt.SetDataSource(ds.Tables[1]);
            crystalReportViewer_HD.ReportSource = objRpt;
            crystalReportViewer_HD.Refresh();
        }