Question : Logon screen

I built a table like the following and a form which acts as a log-on screen but the code I wrote doesnot work properly.

drop table logon;
create table login
(username varchar2(30), password varchar2(30));
insert into login values('Bob', 'password');
insert into login values('Robert', 'password');

in the form under the when mouse click trigger
I typed in the following

declare
v_username varchar2(30);
v_password varchar2(30);

begin
select username, password
into v_username, v_password
from login
where username = v_username;

if v_username = 'bob and v_password = 'password' then
       open_form('e:\forms\workingforms\latest\studentopensupport2.fmx');
else
message('please enter a valid username and password');
end if;
end;

but this doesnot work can anyone tell me where am I going wrong?
thanks
cassiusduke

Answer : Logon screen

Your SELECT ... INTO doesn't return any rows....

declare
v_username varchar2(30); --<----------NULL
v_password varchar2(30);

begin
select username, password
into v_username, v_password
from login
where username = v_username; --<---------- Still NULL

If you're referencing an item on the Form, use a colon as in  :block.item

Alex
Random Solutions  
 
programming4us programming4us