Home > database >  Seek to reassure!!!!!!
Seek to reassure!!!!!!

Time:09-21

The code is as follows:
String j_user_name, j_user_pass
Long is_num
J_user_name=sle_1. Text
J_user_pass=sle_2. Text
If j_user_name="' then
MessageBox (" prompt ", "user is null, please input again!" )
Sle_2. SetFocus ()
Return
End the if
SELECT count (*)
INTO: is_num
FROM the users
WHERE User_Name=: j_user_name and User_Pass=: j_user_pass using sqlca;
If is_num & gt; 0 then
Open (w_main)
Close (the parent)
The else
MessageBox (" password incorrect ", please input again! "" )
End the if
The problem is that connect to the database is successful, the input data in the list at the interface between the user name and password is always "password incorrect", "please input again", but if the user name and password is empty (not fill, directly determine) when they opened the main window, close the login window,,,, why??? The younger brother is a novice, please advise, appreciate!!!!!!

CodePudding user response:

J_user_name=sle_1. Text
J_user_pass=sle_2. Text
Instead of
J_user_name=trim (sle_1. Text)
J_user_pass=trim (sle_2. Text)

There is something wrong with the code specification
If j_user_name="' then
MessageBox (" prompt ", "user is null, please input again!" )
Sle_2. SetFocus ()
Return
End the if
According to the code you wrote user name empty, should is sle_1 SetFocus focus () sets the user name,

Specific tip password error, debugged, check the return value, to determine where there is a problem,

CodePudding user response:

In addition to check j_user_name=' ', but also the isNull (j_user_name)

CodePudding user response:

Check the User_Name and User_Pass field type of table structure, if it is a CHAR, may take Spaces,

INTO: is_num
FROM the users
WHERE ltrim (rtrim (User_Name))=: j_user_name and ltrim (rtrim (User_Pass))=: j_user_pass using the sqlca.

The other, not input can be entered is upstairs, did not check the status of a NULL


If isnull (j_user_name) or isnull (j_user_pass) then
Messagebox (', 'please enter the username and password)
Return
End the if


  • Related