private void LoadDatagridview() { dataGridView1.DataSource = cls.ExecuteQuery("select * from testDatetimePicker2SQL order by ID desc").Tables[0]; dataGridView1.Columns[0].Width = 50; dataGridView1.Columns[1].Width = 170; dataGridView1.Columns[2].Width = 50; }
private void LoadDatagridview() { DieuKienLoc = DKUsername + DKThoiDiem + DKMaHoSo + DKThaoTac + DKDanhMuc + DKNoiDung; string query = "SELECT " + "[ThoiDiem] " + ",[Username] " + ",[MaHoSo] " + ",[ThaoTac] " + ",[DanhMuc] " + ",[NoiDung] " + "FROM [dbo].[tblGiamSatNhapLieu] where 1=1 " + DieuKienLoc; dataGridView1.DataSource = cls.ExecuteQuery(query).Tables[0]; StyleDatagridview(); }
private void ReLoad() { TimDanhSachHoSoBienDong(); for (int i = 0; i < DanhSachMaHoSo.Count; i++) { TreeNode nodeHS = new TreeNode("Hồ sơ: " + DanhSachMaHoSo[i]); treeView1.Nodes.Add(nodeHS); if (GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i])).Length > 0) { for (int j = 0; j < GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i])).Length; j++) { ds.Tables.Clear(); ds = cls.ExecuteQuery(" select * from tblBienDong where MaHoSo =" + DanhSachMaHoSo[i] + " and MaBienDong =" + GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i]))[j]); Contents[0] = ds.Tables[0].Rows[0]["MaHoSo"].ToString(); Contents[1] = ds.Tables[0].Rows[0]["MaBienDong"].ToString(); Contents[2] = Convert.ToDateTime(ds.Tables[0].Rows[0]["NgayBienDong"]).ToString("dd/MM/yyyy"); Contents[3] = ds.Tables[0].Rows[0]["LoaiBienDong"].ToString(); Contents[4] = ds.Tables[0].Rows[0]["NoiDung"].ToString(); if (GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i]))[j] == MaBienDong.ToString()) { Location_Y_Panel += CreatePanel(i, Location_Y_Panel, true, Contents, Contents[1]); } else { Location_Y_Panel += CreatePanel(i, Location_Y_Panel, false, Contents, Contents[1]); } TreeNode nodeBD = new TreeNode("Biến động: " + Contents[1] + " (" + Contents[2] + ")"); nodeBD.Name = Contents[1]; nodeHS.Nodes.Add(nodeBD); treeView1.AfterSelect += treeView1_AfterSelect; } } } treeView1.ExpandAll(); }
private void LoadDataGridview() { string query = " select * from tblTuDienQuyenHan"; dataGridView1.DataSource = cls.ExecuteQuery(query).Tables[0]; }
public static void LoadDataGridView(DataGridView grv, string query) { clsDatabase cls = new clsDatabase(); grv.DataSource = cls.ExecuteQuery(query).Tables[0]; }