Android Query Database issues

Source: Internet
Author: User
Tags database issues


==================== Problem Description ====================
Process user logins in server-side Servlets I wrote that.
if (Sqlconn.executequery ("SELECT * from User_test" WHERE name = ' "+ username +" ' and password = ' "+ Password +" ' ") = null) {Resp.setcontenttype ("text/xml; Charset=utf-8 "); PrintWriter out = Resp.getwriter () out.print ("User" + Username + "Login Success"); Out.flush (); Out.close ();} else {resp.setcontenttype ("text/xml; Charset=utf-8 "); PrintWriter out = Resp.getwriter (); Out.print ("Username or password is incorrect"); Out.flush (); Out.close ();}

But I found that when I enter the wrong username and password, executeQuery () can still query the value and return to [email protected]. It should be said that the user name and password is incorrect when there should be no return value AH. What's going on? Please advise your predecessors
==================== Solution 1====================
The ExecuteQuery query does not return null anyway, it returns the ResultSet object, so you should determine whether the contents of the ResultSet object are empty.

Android Query Database issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.