Пример #1
0
        private string GetID(string username, string pass)
        {
            string id = "";

            try
            {
                con.MoKetNoi();
                // SqlCommand cmd = new SqlCommand("SELECT * FROM TaiKhoan WHERE TenDangNhap ='" + username + "' and MatKhau='" + pass + "'", connect);
                //  SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable dt = con.LayDuLieuBang("SELECT * FROM TaiKhoan WHERE TenDangNhap ='" + username + "' and MatKhau='" + pass + "'");

                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        id = dr["id"].ToString();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi xảy ra khi truy vấn dữ liệu hoặc kết nối với server thất bại !");
            }
            finally
            {
                con.DongKetNoi();
            }
            return(id);
        }
Пример #2
0
 public FNhanphong()
 {
     InitializeComponent();
     con.MoKetNoi();
     HienThiDS();
     con.DongKetNoi();
     Khoadieukhien();
 }
Пример #3
0
 void HienThi()
 {
     con.MoKetNoi();
     dskh.DataSource = BUS.TaoBang("SELECT * FROM KhachHang");
     con.DongKetNoi();
 }
Пример #4
0
 void HienThi()
 {
     con.MoKetNoi();
     msds.DataSource = BUS.TaoBang("SELECT * FROM Phong1");
     con.DongKetNoi();
 }
Пример #5
0
 void HienThi()
 {
     con.MoKetNoi();
     dsnv.DataSource = BUS.TaoBang("SELECT * FROM NhanVien");
     con.DongKetNoi();
 }