gpt4 book ai didi

java - 数据库问题

转载 作者:行者123 更新时间:2023-12-02 00:49:38 26 4
gpt4 key购买 nike

在下面给出的代码中我没有得到任何输出。如果我给出连接成功声明,我会得到它,但不会得到计数。请帮助我

<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:ge","ge","ge");
Statement st=con.createStatement();
//String sql=("select count(*) from employees where status='Present'");
//out.println("Number of present days"+sql);
ResultSet rs = null;

rs = st.executeQuery("select count(*) from employees where status='Present'");
//out.println("connection success");

st.executeQuery("select count(*) from employees where status='Present'");

con.close();

}

catch(Exception e)
{
out.println(""+e);
}

%>

最佳答案

您需要打印它

int rowcount = resultSet.getInt(1);  
out.println(i);

关于java - 数据库问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3749894/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com