打印出sql语句出来看看呀
或是写出代码

解决方案 »

  1.   

    sql语句如下:
    <%
    int n;
    String temp1=new String();
    String temp2=new String();
    temp1=request.getParameter("txtname");
    temp2=request.getParameter("txtpassword");
    n=temp1.length()*temp2.length();
    if(n==0){
    %>
    <p>你的输入有误,请重新输入!</p>
    <p><a href="user.jsp">返回</p>
    <%
    }
    else{
    String tempuser=new String();
                      String tempid=new String();
    int tempupnum;
    String url=new String();
    url="jdbc:odbc:usergl";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection(url);
    Statement stmt=con.createStatement();
    String SQL=new String();
    SQL="SELECT * FROM user WHERE user='"+temp1+"'and password='"+temp2+"'";
    ResultSet rs=stmt.executeQuery(SQL);
    if(rs.next()){
    tempuser=rs.getString("user");
    tempid=rs.getString("id");
                               tempupnum=rs.getInt("upnum")+1;
    rs.close();
    SQL="UPDATE user SET upnum="+Integer.toString(tempupnum)+"WHERE user='"+temp1+"'";
    %>请大侠们帮忙看看!
      

  2.   

    SQL="UPDATE user SET upnum="+Integer.toString(tempupnum)+"WHERE user='"+temp1+"'";  这一句我错   “在查询表达式 '1WHERE user='tt'' 中”的1就是Integer.toString(tempupnum)产生的你应当修改成   SQL="UPDATE user SET upnum="+Integer.toString(tempupnum)+"   WHERE user='"+temp1+"'";  在where 前应加上空格
      

  3.   

    SQL="UPDATE user SET upnum="+Integer.toString(tempupnum)+"WHERE user='"+temp1+"'";  就是where這裡的錯誤,其實像這樣的信息很好調試,只要把你生成的sql語句大印出來就很容易發現了,謝謝!
      

  4.   

    sql语句的问题,一般out.println(sql);一下就能知道了
      

  5.   

    原来是空格的问题!
    感谢文明、笨笨、another等各位朋友,谢谢!