CrystalVis
Technical User
Here is the validate user function in the database:
CREATE OR REPLACE FUNCTION VALIDATEUSER(
VALIDITYCODE OUT NUMBER,
REGISTERUSERIDY OUT TREGISTERUSER.REGISTERUSERIDY%TYPE,
INUSERNAME IN TREGISTERUSER.REGISTERUSERNAME%TYPE,
INUSERPASSWORD IN TREGISTERUSER.USERPASSWORD%TYPE)
RETURN NUMBER IS
/**********************************************************************
* Name: VALIDATEUSER
* Created:
* Modified:
* Description: Validates user logging into the system
**********************************************************************/
codenum number;
CURSOR c_userdetail IS
SELECT * FROM v_registeruser
WHERE RTRIM(UserName) = INUSERNAME
AND RTRIM(UserPassword) = INUSERPASSWORD;
BEGIN
codenum := -1; --assume that there is a valid user record with username and password
FOR users IN c_userdetail LOOP
IF sysdate > users.userexpdate THEN
codenum := 1;
ELSE
codenum := 0;
REGISTERUSERIDY := users.RegisterUserIDY;
END IF;
END LOOP;
VALIDITYCODE := codenum;
RETURN 0;
EXCEPTION
WHEN OTHERS THEN
RETURN -1;
END;
I build a logon screen that contains three objects: two text boxes and a command button. The text boxes are for the user to enter username and password. A command button is to submit the data enter in the text boxes. I would like to call a database function validateuser to validate the username and password that are entered in the text boxes. Can someone please give me sample codes of how to accomplish this task. Please give as much detail as possible because I am a beginner to VB. Your help/suggestion is greatly appreciated.
TIA
CREATE OR REPLACE FUNCTION VALIDATEUSER(
VALIDITYCODE OUT NUMBER,
REGISTERUSERIDY OUT TREGISTERUSER.REGISTERUSERIDY%TYPE,
INUSERNAME IN TREGISTERUSER.REGISTERUSERNAME%TYPE,
INUSERPASSWORD IN TREGISTERUSER.USERPASSWORD%TYPE)
RETURN NUMBER IS
/**********************************************************************
* Name: VALIDATEUSER
* Created:
* Modified:
* Description: Validates user logging into the system
**********************************************************************/
codenum number;
CURSOR c_userdetail IS
SELECT * FROM v_registeruser
WHERE RTRIM(UserName) = INUSERNAME
AND RTRIM(UserPassword) = INUSERPASSWORD;
BEGIN
codenum := -1; --assume that there is a valid user record with username and password
FOR users IN c_userdetail LOOP
IF sysdate > users.userexpdate THEN
codenum := 1;
ELSE
codenum := 0;
REGISTERUSERIDY := users.RegisterUserIDY;
END IF;
END LOOP;
VALIDITYCODE := codenum;
RETURN 0;
EXCEPTION
WHEN OTHERS THEN
RETURN -1;
END;
I build a logon screen that contains three objects: two text boxes and a command button. The text boxes are for the user to enter username and password. A command button is to submit the data enter in the text boxes. I would like to call a database function validateuser to validate the username and password that are entered in the text boxes. Can someone please give me sample codes of how to accomplish this task. Please give as much detail as possible because I am a beginner to VB. Your help/suggestion is greatly appreciated.
TIA