Home » Developer & Programmer » Forms » Project (Oracle Forms 10g)
Project [message #334161] Tue, 15 July 2008 10:26 Go to next message
darknightz1976
Messages: 1
Registered: July 2008
Location: Los Angeles
Junior Member
I have a project for school that I'm having a difficult time trying to complete. I'm working on creating a form with login canvas that requires a username and password. Once confirmed, the login should disappear and a tabbed canvas comes up. Note: the person has to be a manager that can only see his or her work. I created a login canvas with a login button. The script I put for the When-Button-Press Trigger is this:

declare
v_username VARCHAR2(25);
v_passwrd VARCHAR2(25);
a NUMBER;

begin
select username, passwrd
into v_username, v_passwrd
from login
where username = v_username
and passwrd = v_passwrd;

if v_username = :login.username
and v_passwrd = :login.passwrd then
call_form('MAIN');
else
a := show_alert('ALERT_INVALID');
end if;

exception
when others then
a := show_alert('ALERT_LOGIN_ERROR');
end;

I want it to be approved and go to the main canvas. I also would like to have a custom MENU that I created be the default.
Re: Project [message #334172 is a reply to message #334161] Tue, 15 July 2008 12:00 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
First of all welcome to OraFAQ.
You will find a lot of help here, providing you are willing to obey some simple rules.
First rule, which you already complied to, is that we don't do your work. We expect you to do your work; we will only help you getting there.
Rest of the rules (important!) can be found in the Forum Guidelines
Please take a moment to read them. It explains, amongst other things, how to format your post so it is more readable.

Now, for your piece of code.
Check your query. It selects those rows from the table where the column username equals the value of the variable v_username and the column password contains a value equal to the value of the variable v_password.
What is the value of those two variables at that point? Where is this value assigned to these variabes?

You select the found values back into the same variables you use for comparison inside the query. That is bad practice. Variables are free, they don't cost any money. Create a new variable if you need, don't reuse old ones.

A select into will raise a NO_DATA_FOUND exception if no rows are found. You should catch that exception explicitly. Don't use when others. NEVER use when others until you understand why I say this.

Now try again, it's back to you Smile
Previous Topic: REP-3301:Error occurred in Error Checking(RXGLER)
Next Topic: Application locked
Goto Forum:
  


Current Time: Fri Sep 27 14:17:52 CDT 2024