将mysql语句改为 String sql="select * from admin where LoginName='"+name+"'"+" and LoginPwd='"+password+"'"; 多加两个分号~~~~