AXForum  
Go Back   AXForum > Microsoft Dynamics AX > DAX: Программирование
DAX
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Old 03.09.2003, 15:44   #1  
monk is offline
monk
Участник
 
67 / 12 (1) ++
Join Date: 14.10.2002
Common.update()
Привет.
Есть следующий код:

ttsbegin;
qr = new QueryRun(q);
if(qr.next())
{
curTable = qr.get(tableId);
curTable.(fieldId) = value;
curTable.Update();
}
ttscommit;

Возникает ошибка, что запись не выбрана для обновления. То есть не хватает forupdate. Вопрос куда записать forupdate? (Пробовал делать curTable.selectforupdate(true) внутри цикла - не помогает).

Примеров в коде не нашел, может с Common нельзя делать update, а только insert?
Old 03.09.2003, 16:34   #2  
fed is offline
fed
Moderator
fed's Avatar
Ex AND Project
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
2,913 / 5736 (197) ++++++++++
Join Date: 13.03.2002
Location: Hüfingen,DE
Попробуй Query.userUpdate(true).
Должно помочь, хотя я сам не пробовал
Old 03.09.2003, 16:50   #3  
monk is offline
monk
Участник
 
67 / 12 (1) ++
Join Date: 14.10.2002
UserUpdate
UserUpdate = true - позволяет модифицировать сам запрос, но не возвращаемые значения
Old 03.09.2003, 16:53   #4  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Join Date: 09.07.2002
Location: Parndorf, AT
Боюсь, ответ неверный. За выборку на обновление отвечает свойство QueryBuildDatasource.update(). Стало быть код будет примерно такой:
PHP Code:
...
q.dataSourceNo(1).update(true);
qr = new QueryRun(q); 
или такой

PHP Code:
Query tmpQuery;
...
qr = new QueryRun(q);
tmpQuery qr.query();
tmpQuery.datasourceNo(1).update(true);
qr.query(tmpQuery); 
А вот, кстати, и пример в коде (чтобы добить fed): SysQuery::countPrim().
Old 03.09.2003, 16:55   #5  
fed is offline
fed
Moderator
fed's Avatar
Ex AND Project
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
2,913 / 5736 (197) ++++++++++
Join Date: 13.03.2002
Location: Hüfingen,DE
Цитирую:

Query.userUpdate
Run on: Called
Description
This method is used to specify whether the query should be allowed to update the records it fetches, and to determine whether or not this is the case.

Syntax
public final boolean userUpdate( [boolean _value] )

"Should be allowed to update the records it fetches" относится к блокировке извлекаемых записей.
Если я не прав - значит MBS наврал в документации
Old 03.09.2003, 17:09   #6  
monk is offline
monk
Участник
 
67 / 12 (1) ++
Join Date: 14.10.2002
query.datasource.update(true)
Сработало, спасибо.

А что касается UserUpdate = yes, в документации есть такая фраза
determine whether the QueryForm should remember its state when it is reopened. If this property is set to Yes, the previous settings are restored. If this property is set to No, it is only possible to view the data, and editing is forbidden.
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dianne Siebold: Rec Fields Required in AIF Partial Update Blog bot DAX Blogs 0 20.01.2009 09:05
Inside Dynamics AX 4.0: Common Search Blog bot DAX Blogs 0 29.10.2007 10:50
Dianne Siebold: Update on the Dynamics AX SDK Team kashperuk DAX Blogs 1 16.10.2007 08:23
dynamicsusers: The Naked Business Part III - The site update Blog bot DAX Blogs 0 22.05.2007 04:42

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 11:24.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.