你的sql语句有错吧
应该是:
rs=sql.executeQuery("select * from student where 编号=1");
??

解决方案 »

  1.   

    还是要检查一下你的SQL语句,如果你的编号字段是字符串类型的,那么你的SQL语句要修改了,应该是rs=sql.executeQuery("select * from student where 编号='1'");如果你的编号字段是int类型的,那么你上面的SQL语句也有错误,应是rs=sql.executeQuery("select * from student where 编号=1");
      

  2.   

    假如我的编号如  rs=sql.executeQuery("select * from student where 编号="+"'"+bianhao+"'");怎么没有显示??
      

  3.   

    <%String bianhao=request.getParameter("updatetimu");
    if(bianhao==null)
    {
    bianhao="";
    }
    bianhao=codeString(bianhao);
    %>
    <%
    Connection con=null;
    Statement sql=null;
    ResultSet rs=null;
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch(ClassNotFoundException e)
    {}
    try{
    con=DriverManager.getConnection("jdbc:odbc:sun","","");
        sql=con.createStatement();
    rs=sql.executeQuery(" select * from xuanze where 编号="+"'"+bianhao+"'");
    while(rs.next())
    {
    String k_fenzhi=rs.getString("k_fenzhi");
    session.setAttribute("k_fenzhi",k_fenzhi);
    String k_timu=rs.getString("k_timu");
    session.setAttribute("k_timu",k_timu);
    String k_a=rs.getString("k_a");
    session.setAttribute("k_a",k_a);就是这个代码。。出错了。。看看先 。。有问题啊!!