I read the following solution....but can not seem to get it to work for me.
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]
@RETURNVALUE INT OUTPUT
DECLARE @DB_PWD VarChar(16)
SELECT @DB_PWD = DBPassword FROM tblUser WHERE DBUserID = @UID
IF @DB_PWD = @PWD
SET @RETURNVALUE = 1
SET @RETURNVALUE = 0
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
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.