| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1162 人关注过本帖
标题:错误Unknown column 'root' in 'where clause'
只看楼主 加入收藏
GXlover2
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-7-25
收藏
 问题点数:0 回复次数:0 
错误Unknown column 'root' in 'where clause'
try{

   InitialContext ctx=new InitialContext();

   ds=(DataSource)ctx.lookup("java:comp/env/jdbc/xyrcw");

   Connection conn = ds.getConnection();

   Statement stmt = conn.createStatement();

   
   
    String query = "select * from administrator where admin_name="+name;
    ResultSet rs = stmt.executeQuery(query);
    if(rs ==null)
    {
        out.print("<script>msg2();</script>");
    }
   
     while(rs.next()){
     String str=rs.getString("admin_password");
     if (!pwd.equals(str))
    {
        out.print("<script>msg2();</script>");
    }
    }
   
    int id=rs.getInt("admin_id");   
    session.setAttribute("adminId",id);
    session.setAttribute("adminName",name);
    session.setAttribute("adminPwd",pwd);
   
    query = "select * from admin_login_statistics order by admin_login_statistics_id desc;";
     rs = stmt.executeQuery(query);
    int num_results = rs.getRow();
    for ( int i=0 ; i<num_results;i++)
    {
        while(rs.next()){
        if(i>100)
        {
         query = "delete from admin_login_statistics where admin_login_statistics_id="+rs.getInt("admin_login_statistics_id");
         stmt.executeUpdate(query);
        }
        }
    }
   
   
    HttpServletRequest req=null;
    String ip=req.getRemoteAddr();
    String date=new java.sql.Date(new java.util.Date().getTime()).toString();
    query = "insert into admin_login_statistics (admin_name,admin_login_date,admin_login_ip,admin_logout_date)values('"+name+"','"+date+"','"+ip+"','"+date+"')";
   
     stmt.executeUpdate(query);

   
    response.sendRedirect("index.jsp");
}

   catch(Exception ex){

       out.print("<script>msg1();</script>");

    ex.printStackTrace();

   }
输入账号root和密码时出现错误Unknown column 'root' in 'where clause',请问怎么回事?
搜索更多相关主题的帖子: java where query null 
2012-02-28 20:35
快速回复:错误Unknown column 'root' in 'where clause'
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015946 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved