Frequently Used in the work, LINQ queries corresponding sub-level data based on the input data set, organizes and shares, and hopes everyone can use it. In the code, doublesarray is the ID data set of the parent node, query all sub-level data based on the ID data set.
// Obtain the cached data object OBJ = caching. getcache (cachekey + umodel. roleid); If (OBJ! = NULL) // determines whether the cached data is null {sysfunlist = (Dataset) OBJ;} else {string strsql = "select * From view_sysrolelist where loginid = '" + umodel. loginid + "'order by [custom_displayorder]"; sysfunlist = sqlhelper. query (sqlhelper. localsqlserver, strsql. tostring (); caching. setcache (cachekey + umodel. roleid, sysfunlist);} // obtain the data of all parent nodes in the dataset var query = (from T in sysfunlist. tables [0]. asenumerable () where T. field <int> ("custom_parentnodeid") = 0 select T); If (query. count ()> 0) {// LINQ obtains the ID var doublesarray = query for all parent nodes in the data. select (one => one. field <int> ("custom_nodeid"); If (doublesarray. count ()> 0) {// LINQ obtains the corresponding next-level data var foos = from TQ in sysfunlist Based on the ID data. tables [0]. asenumerable () Where doublesarray. contains (TQ. field <int> ("custom_parentnodeid") orderby TQ. field <int> ("custom_displayorder") descending select TQ; // converts it to datatable boundtable = Foos. copytodatatable <datarow> (); repeatermeau. datasource = boundtable; repeatermeau. databind ();}}
LINQ queries the corresponding sub-level data based on the input data set