Quantcast
Channel: SCN : All Content - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2935

how to call stored procedure with parameters?

$
0
0

I created a stored procedure in db like:

 

CREATE PROCEDURE dbo.MySP

@name varchar(50),

@access_date datetime

AS

BEGIN

--insert data into a table

 

End

 

Then I create pb function to call this sp like( I use pb 11.5)

 

datetime ll_date

ll_date =datetime(today(), now())

DECLARE mytest PROCEDURE FOR MySP @objname = :is_name, @access_date = :ll_date USING is_tran;

IF is_tran.SQLCode <> 0 THEN

      MessageBox ( "Error", "DECLARE failed" )

      RETURN

END IF

EXECUTE mytest;

IF ( is_tran.SQLCode <> 0 ) and ( is_tran.SQLCode <> 100 ) THEN

      MessageBox ( "Error", "EXECUTE failed" )

      RETURN

END IF

 

Then I run the app, first time to call this function without any error, but no data inserted, no thing happen.

keep in the app and call the function again, give me error declare error.

 

debug give me SQLCode = 100.

 

SP is fine, I can insert data with isql like:

exec MySP 'name', '2014-06-18'

 

How to figure out the problem and fix it?


Viewing all articles
Browse latest Browse all 2935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>