コード例 #1
0
        /// <summary>
        /// delete data by key value
        /// 删除指定条件数据
        /// </summary>
        /// <returns></returns>
        public int ExecuteCommand()
        {
            //数据库连接
            if (_connectionConfig.IsAutoCloseConnection == false)
            {
                if (_database.CheckStatus() == false)
                {
                    throw new Exception("databse connect not open");
                }
            }
            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Open();
            }

            Int32 count = 0;

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

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

            return(count);
        }