Example #1
0
        public static DataTable GetDataTableWithKeyProxy(string tableName)
        {
            DataTable table = null;
            string    sql   = string.Format("select * from {0}", tableName);

            if (Program.EnableRemoting)
            {
                ClearRelevateSqlKey(sql, m_htDbTable); // 检查相关的sql缓存是否需要重新读取数据

                if (m_htDbTable[sql] == null)
                {
                    table = mDataTableProxy.GetDataTable(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);
        }
Example #2
0
        public static DataTable GetDataTableProxy(string tableName, SqlConnection conn)
        {
            DataTable table = null;

            if (Program.EnableRemoting)
            {
                table = mDataTableProxy.GetDataTable(tableName);
            }
            else
            {
                string sql = string.Format("select * from {0}", tableName);
                sql   = ConvertSqlString(tableName, sql);
                table = GetDataTable(sql, conn);
            }
            return(table);
        }