Home > Net > Judge if the condition is true, what reason did not perform if block of code
Judge if the condition is true, what reason did not perform if block of code
Time:09-30
Try { Conn. The Open (); SqlCommand comm=conn. CreateCommand (); Comm.Com mandText="select * from Admin where UserName='" + User +"' "; SqlDataReader reader=comm. ExecuteReader (); If (reader. The Read ()) { String password=reader. Get string (reader. GetOrdinal (" password ")); String username=reader. Get string (reader. GetOrdinal (" username ")); String useritem=reader. Get string (reader. GetOrdinal (" UserType "));//user level //MessageBox. Show (useritem); MessageBox. Show (password); MessageBox. Show (username); If (password==Pwd) { If (useritem. Equals (uiterm)) MessageBox. Show (" welcome "+ username); New Thread (()=& gt; Application. The Run (new Menu ())). The Start (); Enclosing the Close (); } The else { MessageBox. Show (" password error!" ); The UserName. Text=""; PassWord. The Text=""; } }
CodePudding user response:
Which if judgment is true, which didn't perform a code block
CodePudding user response:
Judging the password and the Pwd that, two equal, the condition is true, but it is below the statement in the else block
CodePudding user response:
The two are not equal, you carefully check it
CodePudding user response:
If there's more Spaces or point in the string
CodePudding user response:
Is the same ah, I put the two respectively displayed are the same
CodePudding user response:
No, it is a simple string
CodePudding user response:
Add in monitoring three values What are the password, see The Pwd, see what the result is Password==Pwd of whether that is true or false