select count(*) from online where ty="学生" ?是不是我理解有错误,你应该不会问这么简单的问题吧。

解决方案 »

  1.   

    select count(*) from online where ty="学生"num=rs(0)'num就是学生鼠了
      

  2.   

    ResultSet rs="select count(*) from online where ty="学生"";
    rs.next();
    int num=rs.getInt(1);
    num就是学生数了
      

  3.   

    <jsp:useBean id="workM" scope="page" class="online.onlineconn1" />
    <%!
    ResultSet rs5 = null;
    int num;
    %>
    <%
    rs5= workM.executeQuery("select count(*) from onlineuser where sf=1");
    num=rs5(0);
    %>
    报错:
    An error occurred at line: -1 in the jsp file: nullGenerated servlet error:
        [javac] Since fork is true, ignoring compiler setting.
        [javac] Compiling 1 source file
        [javac] Since fork is true, ignoring compiler setting.
        [javac] D:\Tomcat 4\work\Standalone\localhost\test\online\content_jsp.java:89: cannot resolve symbol
        [javac] symbol  : method rs5 (int)
        [javac] location: class org.apache.jsp.content_jsp
        [javac] num=rs5(0);
        [javac]     ^
        [javac] 1 error
      

  4.   

    modify:rs5= workM.executeQuery("select count(*) from onlineuser where sf=1");
    rs5.next();//add
    num=rs5(0);
      

  5.   

    modify:rs5= workM.executeQuery("select count(*) from onlineuser where sf=1");
    rs5.next();//add
    num=rs5.getInt(1);