Exemple #1
0
        public void tktheoTruong(object sender, EventArgs e)
        {
            string      select = "select   Mssv, Hotensv, Gioitinh, convert(nvarchar,Ngaysinh,104) As Ngaysinh, Noisinh, Diachi, Sodt, Matruong, Mapsv from tbl_SinhVien where Matruong like N'%" + Truong + "%'";
            CryReportSV insv   = new CryReportSV();

            insv.SetDataSource(ketnoi.laydlbang(select));
            crtInsv.ReportSource = insv;
            crtInsv.Refresh();
        }
Exemple #2
0
 private void btIn_Click(object sender, EventArgs e)
 {
     if (rdInAll.Checked == true)
     {
         string      select = "select * from tbl_SinhVien";
         CryReportSV insv   = new CryReportSV();
         insv.SetDataSource(ketnoi.laydlbang(select));
         crtInsv.ReportSource = insv;
         crtInsv.Refresh();
     }
     else
     {
         if (rdInma.Checked == true)
         {
             string      select = "select * from tbl_SinhVien where Mssv='" + cbchon.Text + "'";
             CryReportSV insv   = new CryReportSV();
             insv.SetDataSource(ketnoi.laydlbang(select));
             crtInsv.ReportSource = insv;
             crtInsv.Refresh();
         }
         else
         {
             if (rdPhong.Checked == true)
             {
                 string      select = "select * from tbl_SinhVien where Mapsv='" + cbchon.Text + "'";
                 CryReportSV insv   = new CryReportSV();
                 insv.SetDataSource(ketnoi.laydlbang(select));
                 crtInsv.ReportSource = insv;
                 crtInsv.Refresh();
             }
             else
             {
                 if (rdtruong.Checked == true)
                 {
                     string      select = "select * from tbl_SinhVien where Matruong='" + cbchon.Text + "'";
                     CryReportSV insv   = new CryReportSV();
                     insv.SetDataSource(ketnoi.laydlbang(select));
                     crtInsv.ReportSource = insv;
                     crtInsv.Refresh();
                 }
                 else
                 {
                     if (rdinAllthe.Checked == true)
                     {
                         string             select = "select Hotensv,Gioitinh,convert(nvarchar,Ngaysinh,104) As Ngaysinh,Mapsv from tbl_SinhVien";
                         CryReportTheTamtru insv   = new CryReportTheTamtru();
                         insv.SetDataSource(ketnoi.laydlbang(select));
                         crtInsv.ReportSource = insv;
                         crtInsv.Refresh();
                     }
                     else
                     {
                         if (rdthePhong.Checked == true)
                         {
                             string             select = "select Hotensv,Gioitinh,convert(nvarchar,Ngaysinh,104) As Ngaysinh,Mapsv from tbl_SinhVien where Mapsv='" + cbchon.Text + "'";
                             CryReportTheTamtru insv   = new CryReportTheTamtru();
                             insv.SetDataSource(ketnoi.laydlbang(select));
                             crtInsv.ReportSource = insv;
                             crtInsv.Refresh();
                         }
                         else
                         {
                             if (rdchuyen.Checked == true)
                             {
                                 string select             = "SELECT dbo.tbl_SVChuyenPhong.MaChuyenPhong, dbo.tbl_SinhVien.Mssv, dbo.tbl_SinhVien.Hotensv, dbo.tbl_SinhVien.Gioitinh, dbo.tbl_SinhVien.Ngaysinh, dbo.tbl_SVChuyenPhong.Phongdango, dbo.tbl_SVChuyenPhong.Phongchuyenden,convert(nvarchar,Ngaychuyen,104) AS Ngaychuyen FROM dbo.tbl_SinhVien INNER JOIN dbo.tbl_SVChuyenPhong ON dbo.tbl_SinhVien.Mssv = dbo.tbl_SVChuyenPhong.Mssv";
                                 CryReportChuyenPhong insv = new CryReportChuyenPhong();
                                 insv.SetDataSource(ketnoi.laydlbang(select));
                                 crtInsv.ReportSource = insv;
                                 crtInsv.Refresh();
                             }
                             else
                             {
                                 MessageBox.Show("Bạn phải chọn trước khi in", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             }
                         }
                     }
                 }
             }
         }
     }
 }