sumithra
sumithra

Reputation: 1

database problem

In the code given below i m not getting any output. if i give that connection success statement i get that but not getting the count. Pls help me

<%@ 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);
}

%>

Upvotes: 0

Views: 91

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240928

You need to print it

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

Upvotes: 3

Related Questions