1. JANG JASON
  2. PowerBuilder
  3. Friday, 14 May 2021 06:08 AM UTC

PowerBuilder 2019 R3 Build 2703
MSSQL : Microsoft SQL Server 2014 - 12.0.2000.8 (Intel X86) Feb 20 2014 19:20:46
Copyright (c) Microsoft Corporation Standard Edition on Windows NT 6.3 <X64> (Build 19041: )

DECLARE proc_chk090 PROCEDURE FOR dbo.sp_chk090 (:sPLU, '2', :gs_cc_code, :gs_sub_code, :s_message) USING SQLCA ;
EXECUTE proc_chk090 ;
FETCH proc_chk090 into :s_message ;
CLOSE proc_chk090 ;

IF SQLCA.SQLCODE <> 0 THEN
ROLLBACK USING SQLCA ;
MessageBox("sp_chk090", s_message)
GOTO CLR_RTN
END IF

When you run the procedure syntax above,
The return message was not returned, so I debugged it.

The debug message came out as below.

I ask for tips from experts to see if there's anything wrong with the phrase I wrote.

[debug message 01]
long code = 102
string sqlerrtext = "SQLSTATE = 42000Microsoft OLE DB Driver for SQL Server'153750000001'The syntax nearby is wrong."
string sqlsyntax = "execute dbo.sp_chk090('153750000001', '2', '480950', '480950', '')"

[debug message 02]
long code = -4
string sqlerrtext = "Cursor is not open"
string sqlsyntax = ""

[debug message 03]
long code = -4
string sqlerrtext = "Procedure has not been executed or has no results"
string sqlsyntax = ""

René Ullrich Accepted Answer Pending Moderation
  1. Friday, 14 May 2021 06:37 AM UTC
  2. PowerBuilder
  3. # 1

Can you give us more information about the procedure declaration?

Is the last parameter for Output? In this case you have to specify the OUTPUT keyword on DECLARE in Powerbuilder. And I think you don't need a FETCH.

See the PowerBuilder help how to declare and execute MS SQL Server procedures: https://docs.appeon.com/pb2019/connecting_to_your_database/ch22s17.html

 

Comment
  1. JANG JASON
  2. Friday, 14 May 2021 06:58 AM UTC
Thank you, René Ullrich.



1. s_message is output.

2. It is the same phenomenon even though we excluded the fetch phrase as you advised.

[Question]

In the Global Local Funeral section of the Generated Application Object, see:

function long sp_chk090(string ag_ex_code,string ag_io,string ag_ccode,string ag_subcode,ref string ag_message) RPCFUNC ALIAS FOR "dbo.sp_chk090"

Why don't we declare it as and apply the program?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.