返回信息流public void jButton1_actionPerformed(ActionEvent e) {
try{
List();
}
catch(SQLException ee){
JOptionPane.showMessageDialog(null, "程序丢失,严重错误!", "错误",
JOptionPane.ERROR_MESSAGE);
}
}
public void List() throws SQLException{
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
JOptionPane.showMessageDialog(null, "数据库连接失败,请确认数据库存在!", "错误",
JOptionPane.ERROR_MESSAGE);
}
try
{
BookingFrame b = new BookingFrame();
Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/manage",
"mingl", "123");
ResultSet rs1, rs2, rs3;
Statement stmt = con.createStatement();
String s = new String(jPasswordField1.getPassword());
String s2 = new String(jTextField2.getText());
rs1 = stmt.executeQuery("SELECT * FROM people WHERE pname='" + s2
+ "'");
rs2 = stmt.executeQuery("select * from people where pname='" + s2
+ "' and ppassword='" + s +
"'");
rs3 = stmt.executeQuery("select * from people where pname='" + s2
+ "' and ppassword='" + s +
"' and pright='1'");
if (!rs1.next())
{
System.out.print("用户名不正确");
} else {
if (!rs2.next()) {
System.out.print("密码不正确");
} else {
if (rs3.next()) {
System.out.print("登陆成功");
b.setVisible(true);
} else {
System.out.print("此用户不存在这个权限");
}
}
}
}
catch (SQLException ex) {
}
}
这是一条镜像帖。来源:北邮人论坛 / database / #594同步于 2007/1/27
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Database机器人发帖
跪请各位大侠帮我看一下这个登陆程序有什么问题?为什么就是执
yuanminglau
2007/1/27镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复