| | |
class, interface, or enum expected
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2007
Posts: 66
Reputation:
Solved Threads: 0
Im getting this on just about every line....anybody see what Im doing wrong?
java Syntax (Toggle Plain Text)
public static int[] getLeadsSummary(UserDataVO userData) throws Exception { Connection connection = null; PreparedStatement pstmt = null; ResultSet resultSet = null; int[] leadsSummary = {0,0}; int leadCount = 0; try { connection = DataBaseConnectionManager.getConnection(); if (connection != null) { if (userData.isAgentType()) { String sqlStmt = "SELECT distinct count (lc.con_id) as TotalLeads FROM LEADS L inner join leads_contactinfo lc on l.fk_conid = lc.con_id" + " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND L.BO_VIEWED = 0 "; // logger.debug(sqlStmt); pstmt = connection.prepareStatement(sqlStmt); pstmt.setInt(1,userData.getAgentId()); resultSet = pstmt.executeQuery(); if (resultSet.next()) { leadsSummary[0] = resultSet.getInt(1); } resultSet.close(); pstmt.close(); // Do it again } else { String sqlStmt = "SELECT count(*) FROM leads l, leads_contactinfo lc " + " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_ADVERID = ? " + " AND l.TIME_STAMP > TO_DATE('" + Integer.toString(month) + "/" + Integer.toString(i+1) + "/" + Integer.toString(year) + " 00:00','MM/DD/YYYY HH24:MI') AND " + " l.TIME_STAMP < TO_DATE('" + Integer.toString(month) + "/" + Integer.toString(i+1) + "/" + Integer.toString(year) + " 23:00','MM/DD/YYYY HH24:MI')"; // logger.debug(sqlStmt); pstmt = connection.prepareStatement(sqlStmt); pstmt.setInt(1,userData.getAdverId()); resultSet = pstmt.executeQuery(); if (resultSet.next()) { leadCount = resultSet.getInt(1); } resultSet.close(); pstmt.close(); } } }catch (SQLException e) { throw new Exception(e); }catch(Exception e){ throw new Exception(e); } finally { try { if (resultSet!=null) resultSet.close(); if (pstmt!=null) pstmt.close(); DataBaseConnectionManager.closeConnection(connection); } catch (SQLException e) { throw new Exception(e); }catch(Exception e){ throw new Exception(e); } } return leadsSummary; }
•
•
Join Date: Apr 2006
Posts: 164
Reputation:
Solved Threads: 10
I am not clear about the problem yet. But seems like you did not declare any class.
In java, almost e'thing is an object. So in order to make your function work, you have to put it inside an object.
sample solution can be:
In java, almost e'thing is an object. So in order to make your function work, you have to put it inside an object.
sample solution can be:
Java Syntax (Toggle Plain Text)
public class MyClassName { public static int[] getLeadsSummary(UserDataVO userData) throws Exception { /** * *all codes inside */ } }
A Perfect World
![]() |
Similar Threads
- interface, or enum expected errors (Java)
- What is the difference between abstract class and interface (Java)
Other Threads in the Java Forum
- Previous Thread: Help!!! Help!!! Help!!!
- Next Thread: Filter JTextField and Display in JTable
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business chat class classes clear client code codesnippet collections component database db defaultmethod development dice dragging draw ebook eclipse error event exception formatingtextintooltipjava fractal game givemetehcodez graphics gui html ide image infinite input integer invokingapacheantprogrammatically j2me java javaprojects jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie numbers openjavafx oracle parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads time tree windows





