14.07.2005, 03:53 | #1 |
Участник
|
calling SQL sp from Axapta
I have a store procedure that returns s number of records from an external database/table based on a parameter.
In Axapta I need to call that sp and get its returned value. Does anybody have an example? Thanks. |
|
14.07.2005, 09:35 | #2 |
Administrator
|
usually, stored procedure returns no value. But Axapta has a class \System Documentation\Classes\UserConnection, which provides access to execute SQL operators. Also Axapta has a class \System Documentation\Classes\Statement, which executes SQL operators (see help on theese classes). In this class exists methods executeQuery() for executing queries, which returns any rows and method executeUpdate() for executing queries, which returns no rows.
Try use theese methods and class \System Documentation\Classes\ResultSet for getting count of your records |
|
14.07.2005, 09:57 | #3 |
Участник
|
Example:
PHP код:
|
|
|
За это сообщение автора поблагодарили: Gustav (1). |
14.07.2005, 13:23 | #4 |
Участник
|
Example: how to pass parameter to stored procedure and get a recordset from it:
PHP код:
|
|
14.07.2005, 18:56 | #5 |
Участник
|
Well, actually the question was how to catch a returned value from stored procedure. Say, my return procedure returns an integer:
RETURN @return_value I don't want to loop through the result set, I just want to get that returned value. The other question, I usually use ODBCConnection, Statement, and ResultSet to accomplish what you showed in your examples. Is there an advantage to use one approach vs. another? Thanks for your input. Good day. |
|
15.07.2005, 00:33 | #6 |
Administrator
|
Цитата:
Say, my return procedure returns an integer:
Function can return value. If you use a function, I recommend to write: PHP код:
|
|
15.07.2005, 00:39 | #7 |
Участник
|
Thank you.
Thank you all.
|
|
|
|