java.sql.SQLException: No value specified for parameter 2

一曲冷凌霜 提交于 2019-12-05 17:22:18

You are assigning both the user and the password to the same parameter (1).

Change this:

pst.setString(1,txt_user.getText());
pst.setString(1,txt_password.getText());

to this:

pst.setString(1,txt_user.getText());
pst.setString(2,txt_password.getText());

SQL indexes starts from zero. use the following statements,

pst.setString(0,txt_user.getText());
pst.setString(1,txt_password.getText());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!