Can not issue NULL query. with root cause

来源:互联网 发布:文笔好的网络作家 编辑:程序博客网 时间:2024/05/19 20:39

<% 

String drivername="com.mysql.jdbc.Driver";            //驱动程序名
 String username="root";                               //用户名
 String password="cjy4286";                             //密码
 String db_name="jsp";                             //数据库名
 String url="jdbc:mysql://localhost/"+db_name+"?user="+username+"&password="+password;   //连接字符串

    Class.forName("com.mysql.jdbc.Driver").newInstance();
    java.sql.Connection conn=DriverManager.getConnection(url);
    java.sql.Statement statement=conn.createStatement();
    String sqlcmd=request.getParameter("sqlcmd");
    String strpage=request.getParameter("strpage");

 %>
    <%
    if(strpage==null)
    {intpage=1;}
    else
    {
        intpage=java.lang.Integer.parseInt(strpage);
        if(intpage<1) intpage=1;
    }
    %>
    <%
    //动态执行分页查询SQL
    java.sql.ResultSet rs=statement.executeQuery(sqlcmd);
   
    rs.last();    
    //得到数据集中总记录数                                    
    recordcount=rs.getRow();

 

数据库连接都对,元素也对。但出现HTTP Status 500 -。给出的原因是 Can not issue NULL query. with root cause。这怎么改啊??

原创粉丝点击