troubleshooting Question

Setting up a call to SQL Server 2000 Stored Procedure from Powerbuilder 10.0 Build 4510

Avatar of stockman001
stockman001 asked on
Editors IDEs
3 Comments1 Solution1185 ViewsLast Modified:
I read the following solution....but can not seem to get it to work for me.

https://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_21863718.html

Here is what I did:

I have a user validation stored procedure in SQL Server that I want to call and return either 1 or 0 depending on if the passwords match.

Here is my SQL Server stored procedure, I tested in Query Analyzer...and it works:

CREATE PROCEDURE [dbo].[Validate_User]
                        @UID VarChar(16),
                        @PWD VarChar(16),
                 @RETURNVALUE INT OUTPUT       
AS

DECLARE @DB_PWD VarChar(16)

SELECT @DB_PWD = DBPassword FROM tblUser WHERE DBUserID = @UID
      
      BEGIN
      IF @DB_PWD = @PWD
            SET @RETURNVALUE = 1
      ELSE
            SET @RETURNVALUE = 0

      END

GO

I set up a standard class object for transactions and declared the following local external function:

FUNCTION integer sp_Validate_User(string ls_UID, string ls_PWD, integer li_returnvalue) RPCFUNC ALIAS FOR "dbo.Validate_User"

I saved the class object as u_transaction_database, and changed the application variables types for SQLCA to u_transaction_database

I put the following code on the login screen underneath the clicked event for my login buttion:

string   ls_UserID , ls_Password
integer li_Result

ls_UserID = 'myUID'  
ls_Password = 'mypassword'

DECLARE sp_InOutString PROCEDURE FOR sp_Validate_User @ls_UID = :ls_UserID,
                               @ls_PWD = :ls_Password,
                               @li_returnvalue = :li_Result OUTPUT,
                               Using sqlca ;

Execute sp_InOutString ;

messagebox("SP RESULT", li_Result)

All li_Result returns is 0....when I know the UID/PWD is correct and return 1.

Thanks!
Dan
ASKER CERTIFIED SOLUTION
gajender_99

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros