AXForum  
Go Back   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Old 23.04.2008, 23:06   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Join Date: 28.10.2006
gatesasbait: Table caching and record delete()/update()/next
Источник: http://gatesasbait.spaces.live.com/B...B9F5!209.entry
==============

 
Good morning,
 
This is a very basic concept. If you get the following error:
"Cannot call NEXT, update(), or delete() on buffer where data is selected or inserted in another transactionscope."
 
It means that the record selected has table caching activated, such as 'NotInTTS' and that you attempted to, for example run code like the following:
 
//wrong
select firstonly forupdate aRecord;
ttsbegin;
aRecord.delete();
ttscommit;
 
It is important in general and necessary for cached tables to begin the transaction scope before selecting the record for update. And so, even for tables that do not have caching enabled, it is strongly discouraged to call NEXT, update(), or delete() on a buffer outside of the transaction scope it was selected in.
 
//good
ttsbegin;
select firstonly forupdate aRecord;

aRecord.delete();
ttscommit;



Источник: http://gatesasbait.spaces.live.com/B...B9F5!209.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Old 24.04.2008, 09:51   #2  
konopello is offline
konopello
SAP
SAP
 
628 / 76 (4) ++++
Join Date: 08.11.2005
Location: Минск
ну да раньше то на такое ошибку выкидывало, а сейчас с этим надо по осторожней : )
Old 24.04.2008, 17:31   #3  
fomenka is offline
fomenka
Участник
 
97 / 14 (1) ++
Join Date: 25.02.2003
И сейчас выкидывает ошибку, просто почти на всех таблицах OccEnabled стоит в Yes. Поэтому код
X++:
select firstonly forupdate aRecord;
ttsbegin;
aRecord.delete();
ttscommit;
для aRecord с включенным на уровне таблице OCC и компилируется, и выполняется нормально.
Но лучше все же писать
X++:
select firstonly optimisticlock aRecord;
ttsbegin;
aRecord.delete();
ttscommit;
- ведь кто-то может и отключить OCC на таблице, тогда будет ругань при компиляции.
Кстати, в книге Inside MS Dynamics Ax4.0 намудрили с ключевыми словами - есть упоминание и optimisticklock, и optimisticlock.
Old 24.04.2008, 22:55   #4  
kashperuk is offline
kashperuk
Участник
kashperuk's Avatar
MCBMSS
Соотечественники
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,361 / 2084 (78) +++++++++
Join Date: 30.05.2004
Location: Atlanta, GA, USA
Quote:
Originally Posted by fomenka View Post
Кстати, в книге Inside MS Dynamics Ax4.0 намудрили с ключевыми словами - есть упоминание и optimisticklock, и optimisticlock.
Не судите строго
Они ж датчане, для них англ. язык тоже не родной
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
axStart: Table caching in AX Blog bot DAX Blogs 3 31.08.2008 16:00
Говорят вышел SP2 для Axapta 3. Кто нибуть что знает на эту тему? soin DAX: Прочие вопросы 10 13.10.2003 10:43

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 01:48.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.