tags:

views:

32

answers:

1

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

%>
+3  A: 

You need to print it

int rowcount = resultSet.getInt(1);  
out.println(i);
org.life.java
Thanks ya its working!!!
sumithra
You can always upvote and select it as answer by clicking a right sign near my answer if it the case :)
org.life.java
OP hasn't enough reputation to upvote.
BalusC
@BalusC Ya then she could accept it at least this as answer :p
org.life.java