public Choose_Priv(ChucNang_form form, string Priv_Type, string table_name = "") { MainForm = form; this.Priv_type = Priv_Type; this.Table_name = table_name; InitializeComponent(); label1.Text = "CHON PRIVILEGES " + Priv_Type + " DE GRANT CHO USER TRONG BANG " + table_name + ": "; if (Priv_Type == "SELECT" || Priv_Type == "UPDATE") //SELECT, UPDATE { name_without_owner = table_name.Split('.')[1]; //name_without_owner = table_name.Split('.')[1]; DataTable Col = Oracle.Get_All_Col(MainForm.Login_Form.conn, name_without_owner); Col.Columns.Add("ENABLED", Type.GetType("System.Boolean")); Col.Columns.Add("WITH GRANT OPTION", Type.GetType("System.Boolean")); foreach (DataRow dr1 in Col.Rows) { dr1["WITH GRANT OPTION"] = false; dr1["ENABLED"] = false; } DataTable Priv_user = Oracle.GetPriv_One_User_2(MainForm.Login_Form.conn, MainForm.username, Priv_Type, name_without_owner); if (Priv_Type == "SELECT") { Select_Priv_Preprocessing(Priv_user); } foreach (DataRow dr in Priv_user.Rows) { foreach (DataRow dr1 in Col.Rows) { if (dr["COLUMN_NAME"].ToString() == dr1["COLUMN_NAME"].ToString()) { if (dr["GRANTABLE"].ToString() == "NO") { dr1["WITH GRANT OPTION"] = false; } else { dr1["WITH GRANT OPTION"] = true; } dr1["ENABLED"] = true; break; } } } Priv_dataGridView.DataSource = Col; } else // INSERT, DELETE { //string name = MainForm.username; DataTable All_tables = Oracle.Get_All_Table(MainForm.Login_Form.conn); All_tables.Columns.Add("ENABLED", Type.GetType("System.Boolean")); All_tables.Columns.Add("WITH GRANT OPTION", Type.GetType("System.Boolean")); foreach (DataRow dr1 in All_tables.Rows) { dr1["WITH GRANT OPTION"] = false; dr1["ENABLED"] = false; } DataTable Priv_user = Oracle.GetPriv_One_User_2(MainForm.Login_Form.conn, MainForm.username, Priv_Type, table_name); foreach (DataRow dr in Priv_user.Rows) { foreach (DataRow dr1 in All_tables.Rows) { if (dr["OBJECT_NAME"].ToString() == dr1["TABLE_NAME"].ToString() && dr["OWNER"].ToString() == dr1["OWNER"].ToString()) { if (dr["GRANTABLE"].ToString() == "NO") { dr1["WITH GRANT OPTION"] = false; } else { dr1["WITH GRANT OPTION"] = true; } dr1["ENABLED"] = true; break; } } } Priv_dataGridView.DataSource = All_tables; //DataTable User_Priv = Oracle.GetPriv_One_User_2(MainForm.Login_Form.conn, name, ); } }