2010-09-20 84 views
0

在下面給出的代碼中我沒有得到任何輸出。如果我給這個連接成功的聲明,我得到的,但沒有得到計數。請幫助我數據庫問題

<%@ 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

您需要打印

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

感謝雅它的工作! – sumithra 2010-09-20 09:42:59

+0

如果是這樣的話,您可以隨時通過點擊我的答案附近的右側標誌來選擇它作爲答案。 – 2010-09-20 09:47:43

+0

OP沒有足夠的信譽來upvote。 – BalusC 2010-09-20 11:09:55