class, interface, or enum expected

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

class, interface, or enum expected

 
0
  #1
Aug 14th, 2007
Im getting this on just about every line....anybody see what Im doing wrong?

  1. public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
  2. Connection connection = null;
  3. PreparedStatement pstmt = null;
  4. ResultSet resultSet = null;
  5. int[] leadsSummary = {0,0};
  6. int leadCount = 0;
  7.  
  8. try {
  9. connection = DataBaseConnectionManager.getConnection();
  10. if (connection != null) {
  11. if (userData.isAgentType()) {
  12. 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" +
  13. " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND L.BO_VIEWED = 0 ";
  14. // logger.debug(sqlStmt);
  15. pstmt = connection.prepareStatement(sqlStmt);
  16. pstmt.setInt(1,userData.getAgentId());
  17. resultSet = pstmt.executeQuery();
  18. if (resultSet.next()) {
  19. leadsSummary[0] = resultSet.getInt(1);
  20. }
  21. resultSet.close();
  22. pstmt.close();
  23.  
  24. // Do it again
  25.  
  26. } else {
  27. String sqlStmt = "SELECT count(*) FROM leads l, leads_contactinfo lc " +
  28. " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_ADVERID = ? " +
  29. " AND l.TIME_STAMP > TO_DATE('" + Integer.toString(month) + "/" +
  30. Integer.toString(i+1) + "/" + Integer.toString(year) + " 00:00','MM/DD/YYYY HH24:MI') AND " +
  31. " l.TIME_STAMP < TO_DATE('" + Integer.toString(month) + "/" +
  32. Integer.toString(i+1) + "/" + Integer.toString(year) + " 23:00','MM/DD/YYYY HH24:MI')";
  33. // logger.debug(sqlStmt);
  34. pstmt = connection.prepareStatement(sqlStmt);
  35. pstmt.setInt(1,userData.getAdverId());
  36. resultSet = pstmt.executeQuery();
  37. if (resultSet.next()) {
  38. leadCount = resultSet.getInt(1);
  39. }
  40. resultSet.close();
  41. pstmt.close();
  42. }
  43. }
  44. }catch (SQLException e) {
  45. throw new Exception(e);
  46. }catch(Exception e){
  47. throw new Exception(e);
  48. } finally {
  49. try {
  50. if (resultSet!=null) resultSet.close();
  51. if (pstmt!=null) pstmt.close();
  52. DataBaseConnectionManager.closeConnection(connection);
  53. } catch (SQLException e) {
  54. throw new Exception(e);
  55. }catch(Exception e){
  56. throw new Exception(e);
  57. }
  58. }
  59.  
  60. return leadsSummary;
  61. }
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 2
Reputation: seenukarthi is an unknown quantity at this point 
Solved Threads: 1
seenukarthi's Avatar
seenukarthi seenukarthi is offline Offline
Newbie Poster

Re: class, interface, or enum expected

 
0
  #2
Aug 14th, 2007
Can U please post the error what u get
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

Re: class, interface, or enum expected

 
0
  #3
Aug 14th, 2007
sure....
class, interface, or enum expected
[javac] public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 164
Reputation: orko is an unknown quantity at this point 
Solved Threads: 10
orko orko is offline Offline
Junior Poster

Re: class, interface, or enum expected

 
0
  #4
Aug 14th, 2007
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:
  1. public class MyClassName
  2. {
  3. public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
  4. /**
  5. *
  6. *all codes inside
  7. */
  8. }
  9. }
A Perfect World
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

Re: class, interface, or enum expected

 
0
  #5
Aug 15th, 2007
thanx
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC