Пример #1
0
        /// <summary>
        /// check data exist by filter
        ///  检查表中是否存在指定内容
        /// </summary>
        /// <returns></returns>
        public Boolean Exist()
        {
            //数据库连接
            if (_connectionConfig.IsAutoCloseConnection == false)
            {
                if (_database.CheckStatus() == false)
                {
                    throw new Exception("databse connect not open");
                }
            }
            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Open();
            }

            long Count;

            if (filterDefinition != null)
            {
                Count = _database.GetDataCount(_databasename, _TableName, filterDefinition);
            }
            else
            {
                Count = _database.GetDataCount(_databasename, _TableName, filterDefinition);
            }

            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Close();
            }

            if (Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }