Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// System.out.println("XOX");
con = DriverManager.getConnection(connectionUrl);
// System.out.println("XOX..");
String Uinfo = "SELECT UserName,UserPwd FROM Login";
// System.out.println("XXX");
stmt = con.createStatement();
// System.out.println("000");
rs1 = stmt.executeQuery(Uinfo);
你都写到这了,下面就照着我说的写呗。
一条记录就
rs1.next();
Uname = rs1.getString(0);
Upwd = rs1.getString(1);
多条就
while(rs1.next()) {
Uname = rs1.getString(0);
Upwd = rs1.getString(1);
} 我说的很明白了吧。
用户名,号码,性别,email都是字符型的吧 String sql="insert into mysql.会员表(name,number,sex,email) values ('"+username+"','"+password+"','"+sex+"','"+email+"')"; 刚才说错了,是双引号在单引号里边