private string AutoLoadColumns() { if (_p_缓存的数据库列.ContainsKey(DbTable)) { return(_p_缓存的数据库列[DbTable]); } var rawto = string.Empty; lock (olock) { var __p = new Dictionary <string, bool>(); System.Data.DataTable colsTable = null; string fetchSql = string.Format("select * from {0} where 0", DbTable); colsTable = RunDB.GetDataTable(fetchSql, null, DbConnectionString); if (colsTable == null || colsTable.Columns == null || colsTable.Columns.Count < 1) { throw new Exception("数据表读取失败"); } foreach (System.Data.DataColumn xi in colsTable.Columns) { if (xi.ColumnName.Equals(PkName, StringComparison.CurrentCultureIgnoreCase)) { continue; } if (!__p.ContainsKey(xi.ColumnName)) { __p.Add(xi.ColumnName, true); } } rawto = (string.Join("|", __p.Keys).GetForkColumn()); _p_缓存的数据库列.Add(DbTable, rawto);//.ToLower() } return(rawto); }
public List <T> ToList(string sql, Hashtable ht = null, string connstr = null) { return(this.ToList <T>(RunDB.GetDataTable(sql, ht, connstr ?? DbConnectionString))); }