示例#1
0
        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);
        }
示例#2
0
文件: Helper.cs 项目: weimingtom/pap2
        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);
        }