public DataTable LayMaPhieuTra()
 {
     try
     {
         string strSQL = "SELECT MaPT FROM PHIEUTRASACH ORDER BY MaPT";
         provider.Connect();
         DataTable dtTable = provider.SELECT(CommandType.Text, strSQL);
         return(dtTable);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         provider.DisConnect();
     }
 }
 public DataTable LaySachTrongPhieuMuon(string MaSach)
 {
     try
     {
         string strSQL = "SELECT S.TenSach, TG.TenTacGia, TL.TenTheLoai, S.TTS" +
                         " FROM SACH S, TACGIA TG, THELOAISACH TL" +
                         " WHERE S.MaSach = @MaSach AND S.MaTacGia = TG.MaTacGia AND S.MaTheLoai = TL.MaTheLoai";
         provider.Connect();
         DataTable dtTable = provider.SELECT(CommandType.Text, strSQL,
                                             new SqlParameter {
             ParameterName = "@MaSach", Value = MaSach
         });
         return(dtTable);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         provider.DisConnect();
     }
 }
        public DataTable LayThongTinSach(string MaSach)
        {
            try
            {
                string strSQL = "SELECT S.MaSach, S.TenSach, TG.TenTacGia, TL.TenTheLoai FROM TACGIA TG JOIN SACH S INNER JOIN THELOAISACH TL " +
                                "ON TL.MaTheLoai = S.MaTheLoai ON S.MaTacGia = TG.MaTacGia " +
                                "WHERE S.MaSach = @MaSach";
                provider.Connect();

                DataTable dtSach = provider.SELECT(CommandType.Text, strSQL,
                                                   new SqlParameter {
                    ParameterName = "@MaSach", Value = MaSach
                });

                return(dtSach);
            }
            catch (Exception ex)
            {
                throw ex;
            }finally
            {
                provider.DisConnect();
            }
        }
示例#4
0
        public Dictionary <string, string> LoadDanhSachTuyenXe()
        {
            provider.Connect();
            DataTable kq = provider.Select(CommandType.Text, @"select * from Tuyen");

            Dictionary <string, string> ds = new Dictionary <string, string>(); //key chua ID tuyen, value chứa tên tuyến

            foreach (DataRow row in kq.Rows)
            {
                ds.Add(row["ID_Tuyen"].ToString(), row["TenTuyen"].ToString());
            }
            provider.DisConnect();
            return(ds);
        }