public static DataTable GetDataTableWithKeyTopRowProxy(string tableName) { string sql = string.Format("select top 1 * from {0}", tableName); DataTable table = null; if (Program.EnableRemoting) { ClearRelevateSqlKey(sql, m_htDbTable); // 检查相关的sql缓存是否需要重新读取数据 if (m_htDbTable[sql] == null) { table = mDataTableProxy.GetDataTableTopRow(tableName); if (m_htDbTable.Keys.Count > dbTableCacheSize) { m_htDbTable.Clear(); } m_htDbTable[sql] = table; } else { table = m_htDbTable[sql] as DataTable; } } else { table = GetDataTableWithKey(sql); } return(table); }
public static DataTable GetDataTableTopRowProxy(string tableName, SqlConnection conn) { string sql = string.Format("select top 1 * from {0}", tableName); DataTable table = null; if (Program.EnableRemoting) { table = mDataTableProxy.GetDataTableTopRow(tableName); } else { table = GetDataTable(sql, conn); } return(table); }