String sql="update users set(name,http,email,qq,msn,moblie,tell,province,address,occupation,sex,city) values(?,?,?,?,?,?,?,?,?,?,?,?) where username='"+username+"' and password='"+password+"'";
   Connection conn =Dbconn.getConn();
   PreparedStatement stmt=conn.prepareStatement(sql);
   stmt.setString(1,pn);
   stmt.setString(2,w);
   stmt.setString(3,mail);应该是where那里错误,怎样改正

解决方案 »

  1.   

    MySQL支持这种SQL吗?
    update tlb set (col1,col2) values (v1,v2);改成String sql="update users set name=?,http=?,email=?,qq=?,msn=?,moblie=?,tell=?,province=?,address=?,occupation=?,sex=?,city=? where username='"+username+"' and password='"+password+"'"; 
      

  2.   

    楼主mysql的update应写成下面的格式:
    update users set  name = ? , http=?, email=?, qq=?, msn=?,  mobile=?, .....,sex=?,city ?,?,?,?) =? where username='username' and password='password';
    你那格式mysql不支持,他会说你语法错误的