Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经设置了一个 gui,它有一个登录界面和一个存储用户名和密码的数据库,但是当我尝试登录 gui 时,即使我输入了数据库中的确切数据,它也会给我无效的登录。
将您的 Sql 语句更改为
select userName,password from person where userName = ? and password = ?
代替
select userName from person where userName = ? and password = ?
更新
事实上,您无需在 java 代码中再次检查用户名和密码,您的查询本身会告诉您他/她是否有效