AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.11.2012, 22:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax-erp: Independent transaction in AX
Источник: http://microsoft-dynamics-ax-erp.blo...ion-in-ax.html
==============


Sometimes we need to write some data into a database independently on the currently running DB transaction. For example, we want to log some state occurred in the application, however any exception could cause a rollback of the whole transaction, including the log entry. It could look as follows:
LogTable logTable;
;
ttsbegin;
logTable.Message = "Something happens";
logTable.insert();
//some following code in the same transaction throws an exception
throw Exception::Error;
ttscommit;

It can be resolved quite easily. We need to create a separate database connection and possibly our own transaction. The modification of the preceding code would look as follows:
LogTable logTable;
UserConnection connection = new UserConnection();
;
ttsbegin;
//use another connection
logTable.setConnection(connection);
//beginning of the independent transaction
logTable.ttsbegin();
logTable.Message = "Something happens";
logTable.insert();
logTable.ttscommit();
//this exception doesn't affect the logTable entry
throw Exception::Error;
ttscommit;








Источник: http://microsoft-dynamics-ax-erp.blo...ion-in-ax.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
За это сообщение автора поблагодарили: Pandasama (1).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
Inside Dynamics AX 4.0: Transaction Semantics Blog bot DAX Blogs 0 31.10.2007 23:40

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:31.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.