Está en la página 1de 3

string clave, login, estado

select usuario, password, activo


into :login, :clave, :estado
from usuario
where usuario = :sle_login.text and password = :sle_contra.text and activo = "SI";
if sle_login.text<>"" and sle_contra.text <>"" then
if sle_contra.text = clave then
open(w_principal)
close(w_inicio)
else
op = op + 1
messagebox("Disculpe","Usted no tiene acceso al sistema!!!",stopsign!)
sle_login.text = ""
sle_contra.text = ""
sle_login.setfocus( )
if op = 3 then
messagebox("Aviso","Usted excedió el número de intentos")
Halt close
end if
end if
else
messagebox("Aviso","Por favor ingrese sus datos!!!")
sle_login.setfocus( )
end if
Entonces lo que hago aquí es, declarar la variable op en Instance Variables, o sea
pongo:
int op
string nom,cla 

select Usuario,Password into :nom,:cla from Registro where Usuario=:sle_nombre.text and Password=:sle_pass.text; 

if Blio.sqlcode = 100 then 


contador=contador+1 
messagebox('Advertencia','Nombre Incorrecto o Contraseña errada',exclamation!) 
if contador = 3 then 
messagebox('Aviso','Intentos Fallidos, El Sistema se Cerrará',exclamation!) 
else 
sle_nombre.text="" 
sle_pass.text="" 
sle_nombre.setfocus() 
end if 

else 
open(w_administrador) 
end if 
string ls_nombre,ls_pass 
long ll_count 

ls_nombre = Trim ( sle_nombre.text ) 


ls_pass = Trim ( sle_pass.text ) 

select Count ( * ) 
into: ll_count 
from Registro 
where ( ( Registro.Usuario=:ls_nombre ) and 
( Registro.Password=: ls_pass ) ) ; 

if ll_count <= 0 then 


contador ++ 
messagebox('Advertencia','Nombre Incorrecto o Contraseña errada',exclamation!) 
if contador = 3 then 
messagebox('Aviso','Intentos Fallidos, El Sistema se Cerrará',exclamation!) 
else 
sle_nombre.text="" 
sle_pass.text="" 
sle_nombre.setfocus() 
end if 

else 
open(w_administrador) 
end if 

También podría gustarte