Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Microsoft SQL Server Update – PB Docs 2019 – PowerBuilder Library

Microsoft SQL Server Update – PB Docs 2019

Microsoft
SQL Server Update

Using the SQL Code property

If you know for sure that a particular procedure can never return
result sets, then the EXECUTE statement is all that is needed. If there is
a procedure that may or may not return a result set, you can test the
SQLCode property of the referenced transaction object for +100 (the code
for NOT FOUND) after the EXECUTE.

The following table shows all the possible values for SQLCode after
an EXECUTE:

Return code

Means

0

The EXECUTE was successful and at least one result
set is pending. Regardless of the number of FETCH statements
executed, the procedure must be explicitly closed with a CLOSE
statement.

This code is returned even if the result
set is empty.

+100

Fetched row not found.

-1

The EXECUTE was not successful and no result sets
were returned. The procedure does not require a CLOSE. If a CLOSE
is attempted against this procedure an error will be
returned.

Example 1

Assume the default transaction object (SQLCA) has been assigned
valid values and a successful CONNECT has been executed. Also assume the
description of the SQL Server procedure good_employee is:

This example illustrates how to execute a stored procedure that does
not return any result sets:

Error checking

Although you should test the SQLCode after every SQL statement,
these examples show statements to test the SQLCode only to illustrate a
specific point.

Example 2

Assume the default transaction object (SQLCA) has been assigned
valid values and a successful CONNECT has been executed. Also assume the
description of the SQL Server procedure get_employee is:

This example illustrates how to pass parameters to a database stored
procedure. Emp_id_var has been set elsewhere to 691:

PowerBuilder also provides access to return values and output
parameters. The return values and output parameters are always in the last
result set returned by the stored procedure and they are in this
order:

Example 3

Assume the default transaction object (SQLCA) has been assigned
valid values and a successful CONNECT has been executed. Also assume the
description of the SQL Server procedure return is:

where @m1, @m2, and @resultp are integers.

This example shows how PowerBuilder provides access to return
values:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x