Home > database >  PB do books management system management system login problem
PB do books management system management system login problem

Time:10-03

The use of PB in books management system management system, user name password login screen need
Now know that one way to do this is to write a * * *. The ini file, deposited in the corresponding logid and logpass
And then through the ProfileString function assignment
But this seems to be only one user name and password

If you want to achieve multi-user when
I did this:

Declared variables:
Declare the ABC cursor for
SELECT id, password
FROM the users.
//users is a table, the id and the password used to save the username and password


Login button clicked event driver

String ls_id, ls_ps
Open the ABC;
Fetch the ABC into: ls_id, : ls_ps;
IF sle_id. Text=ls_id and sle_pass. Text=ls_ps THEN
Messagebox (' system login successful ', 'welcome your arrival, + ls_id +'! ')
Close the ABC;
The else
MessageBox (' login error ', 'user name or password error, please input again! ')
Sle_id. Text='
Sle_pass. Text='
End the if


But the specific implementation, only the first set of data input the users list prompt login successfully, the other groups say the user name or password mistake...
How can ABC pointer to a set of validation of a set of
id and password?

CodePudding user response:

Select count (*) into: (I) from the user where id=: sle_id. Text and password=: sle_pass;

If I & gt; 0 then
Messagebox (' system login successful ', 'welcome your arrival, + ls_id +'! ')
Close the ABC;
The else
MessageBox (' login error ', 'user name or password error, please input again! ')
Sle_id. Text='
Sle_pass. Text='

end if

CodePudding user response:

Don't have to define the cursor

Changes are as follows:
Login button clicked event driver

 
String ls_id, ls_ps
Int count
Ls_id=trim (sle_id. Text)
Ls_ps=trim (sle_pass. Text)

Select count (*) into: count
From the users where id=: ls_id and password=: ls_ps;
IF the count=1 THEN
Messagebox (' system login successful ', 'welcome your arrival, + ls_id +'! ')
The else
MessageBox (' login error ', 'user name or password error, please input again! ')
Sle_id. Text='
Sle_pass. Text='
End the if

CodePudding user response:

Just write SQL directly, using a cursor much trouble!
There is a problem, and it wrote you no condition! Is the query all


String ls_id, ls_ps

Ls_id=trim (sle_id. Text)

Select the password into: ls_ps
From the users
Where id=: ls_id;
If the sqlca. Sqlcode=100 then
MessageBox (' login error ', 'user error, please input again! ')
Return
End the if

If sle_pass. Text=ls_ps then
Messagebox (' system login successful ', 'welcome your arrival, + ls_id +'! ')
Close the ABC;
The else
MessageBox (' login error ', 'wrong password, please enter again! ')
Sle_id. Text='
Sle_pass. Text='
End the if

CodePudding user response:

OPEN the ABC;
ABC implementation success is CLOSE, why you don't succeed no matter oil standard ABC?

CodePudding user response:

refer to the second floor SummerHeart response:
don't have to define the cursor

Changes are as follows:
Login button clicked event driver


SQL code
String ls_id, ls_ps
Int count
Ls_id=trim (sle_id. Text)
Ls_ps=trim (sle_pass. Text)

Select count (*) into: count
From the users where id=: ls_id and password=: ls_ps;
IF the count=1 THEN
Messagebox (' system login successful ', 'welcome your arrival, + ls_id +'! ')
The else
MessageBox (' login error ', 'user name or password mistake, please lose again...


After replication in
Select count (*) into: count
This code is error

CodePudding user response:

 string as_emp_id, as_emp_pass 
Int I

As_emp_id=sle_1. Text
As_emp_pass=sle_2. Text

If len (as_emp_id)=0 or len (as_emp_pass)=0 then
Messagebox (" error ", "user name or password cannot be empty!" , the exclamation! , ok!
Return
End the if

Select 1 into: I
From the users
Where id=: as_emp_id and
Password=: as_emp_pass;

If the sqlca. Sqlcode & lt;> 0 then
Messagebox (" error ", "user name or password mistake, please input again", the exclamation! , ok!
Return
End the if

//it back into the system the code
  • Related