protected void Page_Load(object sender, EventArgs e) { DataQLNSDataContext conn = new DataQLNSDataContext(@"Data Source=DESKTOP-QO35TO8\SQLEXPRESS;Initial Catalog=QuanLyNhanSu;Integrated Security=True"); var myQuery = from i in conn.tblNhanViens select i; gvNhanVien.DataSource = myQuery; gvNhanVien.DataBind(); gvNhanVien1.DataSource = myQuery; gvNhanVien1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { DataQLNSDataContext conn = new DataQLNSDataContext(@"Data Source=DESKTOP-QO35TO8\SQLEXPRESS;Initial Catalog=QuanLyNhanSu;Integrated Security=True"); string manv = Application["manv"].ToString(); var myQuery = from i in conn.tblNhanViens where i.MaNV == manv select i; if (myQuery.Count() == 0) { return; } tblNhanVien itemnv = myQuery.First(); }