还是数据库问题!
数据源aa,表admin,表中数据 admin,password,是不是画红线的地方不对,总是连不上
try{
String sql="select * from admin where admin='"+textfield.getText().trim()+"' and password='"+passwordfield.getPassword().trim()+"'";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:aa");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next()){
JOptionPane.showMessageDialog(null,"登陆成功!");
}
else{
JOptionPane.showMessageDialog(null,"用户名或密码不正确,请重新输入!");
}
}
catch(Exception sq){}