C# DataGridView 欄位隱藏(隱藏欄位)
C# DataGridView 欄位隱藏(隱藏欄位)
資料來源:https://msdn.microsoft.com/zh-tw/library/0c24a0d7(v=vs.110).aspx
public void showSQLiteTable2GridView()
{
/*
SELECT P_Department.uid AS NO,P_Department.Name AS {0},People_List.C_name AS {1},COUNT(Fingerprint_List.PL_uid) AS amount
FROM Fingerprint_List,People_List,P_Department
WHERE (Fingerprint_List.PL_uid==People_List.uid) AND (People_List.PD_uid==P_Department.uid)
GROUP BY Fingerprint_List.PL_uid
ORDER BY P_Department.uid;
*/
String StrSQL = String.Format(“SELECT P_Department.uid AS P_NO,People_List.uid AS U_NO,P_Department.Name AS {0},People_List.C_name AS {1},COUNT(Fingerprint_List.PL_uid) AS amount FROM Fingerprint_List,People_List,P_Department WHERE (Fingerprint_List.PL_uid==People_List.uid) AND (People_List.PD_uid==P_Department.uid) GROUP BY Fingerprint_List.PL_uid ORDER BY P_Department.uid;”,
CW40_label12.Text.Replace(‘ ‘, ‘_’).Substring(0, CW40_label12.Text.Length – 1), CW40_label11.Text.Replace(‘ ‘, ‘_’).Substring(0, CW40_label11.Text.Length – 1));
DataTable dt = SQLite.GetDataTable(SQLite.DBpath, StrSQL);
CW40_dataGridView1.DataSource = dt;
CW40_dataGridView1.Columns[“P_NO”].Visible = false;//隱藏欄位,在這裡NO要拿來做選擇用
CW40_dataGridView1.Columns[“U_NO”].Visible = false;//隱藏欄位,在這裡NO要拿來做選擇用
SQLite.CloseConn();
}
One thought on “C# DataGridView 欄位隱藏(隱藏欄位)”
datagridview 欄位 隱藏 顯示