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 cursorChanges 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: