public static Hashtable[] GetComboCaches(string key, DBCustomClass dbClass) { if (m_htComboCaches[key] == null) { Hashtable[] htReturn = new Hashtable[3]; string[] keys = key.Split(new Char[] {','}); string strlisttable = keys[0]; string strliscondition = keys[1]; string strlistf = keys[2]; string strlistk = keys[3]; string strlistfex = keys[4]; string sql = "SELECT * FROM " + strlisttable; if (strliscondition.Length > 0) sql += " WHERE " + strliscondition; /*DataTable tbl = Helper.GetDataTable(sql, Conn);*/ DataTable tbl = GetDataTableWithKeyProxy(strlisttable, strliscondition, null); Hashtable comhashkeys = new Hashtable(); Hashtable comhashvalues = new Hashtable(); Hashtable comhashfieldsex = dbClass.GetListFieldExArray(strlistfex); // 下拉框可以获取一些额外的字段,以便于脚本访问从表字段内容 Hashtable modihash = comhashfieldsex == null ? null : (Hashtable)comhashfieldsex.Clone(); Hashtable comfieldsexContainer = new Hashtable(); foreach (DataRow comborow in tbl.Rows) { string strkey = dbClass.GetFieldStrNoLower(comborow, strlistk); string newStrListF = dbClass.GetFieldStr(comborow, strlistf) + "[" + strkey + "]"; comhashkeys[newStrListF] = strkey; comhashvalues[strkey] = newStrListF; if (comhashfieldsex != null) { foreach (string eachkey in comhashfieldsex.Keys) { if (comborow[eachkey] != null) { modihash[eachkey] = comborow[eachkey].ToString(); } else modihash[eachkey] = ""; } if (comhashfieldsex.Count > 0 && !comfieldsexContainer.ContainsKey(strkey)) comfieldsexContainer[strkey] = modihash.Clone(); // 每一行形成一个HASHTABLE } } htReturn[0] = comhashkeys; htReturn[1] = comhashvalues; htReturn[2] = comfieldsexContainer; // 每一行记录形成一个HASHTABLE,容器的KEY值中listfieldID值 if (m_htComboCaches.Keys.Count > comboCacheSize) { m_htComboCaches.Clear(); } m_htComboCaches[key] = htReturn; } return (Hashtable[])(m_htComboCaches[key]); }