axapta 表插入/更新
再次出现 axapta 问题(在 ax 2009 和 sql-server 2008 r2 上运行): 插入或更新的数据集存储在相关数据库中的确切时间点是什么?
目的是调用 sql-server 上的存储过程,将数据从 ax-table (例如 inventtable )传输到另一个(不是用 axapta 生成的)表。在表方法之一上通过 odbc 从 axapta 执行存储过程(即使在 super() 调用之后)会触发存储过程,但在通过 smss 选择时找不到刚刚在 axapta 中添加或修改的数据( select *来自 dbo.inventtable )。
我知道数据已经存储在数据库中的唯一地方是相关表单上数据源上的方法,但这会很丑陋,因为数据可以通过 ax 中的 n 个表单进行编辑。
那么有没有办法将调用放在表格上而不是表单的数据源上?
感谢您的提前提示!
and once again an axapta-question ( running on ax 2009 and sql-server 2008 r2 ):
which is exactly the point of time, when inserted or updated datasets are stored in the regarding database?
the aim is to call a stored procedure on the sql-server which transfers data from the ax-tables ( eg inventtable ) to another ( not generated with axapta ) table. executing the stored procedure via odbc from axapta on one of the table-methods ( even after super() call ) triggers the stored procedure, but the data which was just added or modified in ax isn't found while selecting via smss ( select * from dbo.inventtable ).
the only place i know yet where the data is already stored in db is on the methods on the datasource on the regarding form, but this would be quiet ugly, since the data could be edited via n forms from ax.
so is there a way to put the call on the table instead on the forms' datasources?
thanks for hints in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AX 数据在
doInsert()
/doUpdate()
或super()
调用时“存储”在数据库中>insert()/update() 方法。但是,正如 Jay 提到的,这些记录对其他事务不可见(除非您明确允许脏/未提交的选择)。因此它可能对您的存储过程不可见。
无论如何,我不建议在
insert()/update()
中调用存储过程,因为这会影响性能,而且您现在依赖于另一个活动的数据库!解决方法:
日志表布局(数百万之一):
建议:
DATAAREAID
(必须以这种方式拼写)。LogStatus
更新为 1,在加入和更新之后将其更新为 2。The AX data is "stored" in the database at the point of
doInsert()
/doUpdate()
orsuper()
calls ininsert()/update()
methods.However, as Jay mentioned, the records will not be visible to other transactions (unless you explicitly allow dirty/uncommitted selects). So it may not be visible to your stored procedure.
I would not recommend calling stored procedures in
insert()/update()
anyway as this has performance implications, and you are now depending on yet another database being alive!The way to go:
Log table layout (one of millions):
Recommendations:
DATAAREAID
(must be spelled this way) as well.LogStatus
to 1 before the join and to 2 after the join and update.将调用放在 insert() 或 update() 表方法中的 super() 调用之后是执行此操作的正确位置,但是除非您执行未提交的读取,否则存储过程中的 select 语句将不会看到数据,直到之后AX 中的交易已提交。
您能否使用 X++ 中的 ODBC 连接直接写入外部表,而不是通过存储过程间接写入?
Putting the call after the super() call in the insert() or update() table method is the correct place to do that, however unless you do an uncommitted read the select statement in your stored procedure won't see the data until after the transaction in AX is committed.
Could you use the ODBC connection from X++ to write to the external table directly instead of indirectly via a stored procedure?