We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,397 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

java.lang.Exception: java.sql.SQLException: Invalid column index

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();
3
Contributors
2
Replies
47 Minutes
Discussion Span
5 Years Ago
Last Updated
3
Views
Question
Answered
mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

You are selecting one column but trying to read two.

Ezzaral
null
Moderator
16,111 posts since May 2007
Reputation Points: 3,292
Solved Threads: 873
Skill Endorsements: 28
Question Answered as of 5 Years Ago by Ezzaral

thanx playa!!

mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0635 seconds using 2.72MB