Im getting invalid coulmn index...any suggestions?...thanx in advance

public static int[] getListSummary(UserDataVO userData) throws Exception {
        Connection connection	= null;
        PreparedStatement pstmt	= null;
        ResultSet resultSet		= null;
        int[] listSummary = {0,0};
        int leadCount = 0;
        
        try {
            connection = DataBaseConnectionManager.getConnection();
            if (connection != null) {
                    if (userData.isAgentType()) {
                        String sqlStmt = "SELECT COUNT(PK_LISTID) as TheCount  FROM OLS_LISTING t" +
                        " WHERE t.fk_agentid1 = ?  or t.fk_agentid2 = ? ";
 
//                        logger.debug(sqlStmt);
                        pstmt = connection.prepareStatement(sqlStmt);
                        pstmt.setInt(1,userData.getAgentId());
                        pstmt.setInt(2,userData.getAgentId());
                        resultSet = pstmt.executeQuery();
                         resultSet.next(); 
                            listSummary[0] = resultSet.getInt(1);
                            listSummary[0] = resultSet.getInt(2);
                        
                        resultSet.close();
                        pstmt.close();

You are selecting one column but trying to read two.

thanx playa!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.