944,123 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 11941
  • Java RSS
Aug 14th, 2007
0

class, interface, or enum expected

Expand Post »
Im getting this on just about every line....anybody see what Im doing wrong?

java Syntax (Toggle Plain Text)
  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. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mimsc is offline Offline
70 posts
since Aug 2007
Aug 14th, 2007
0

Re: class, interface, or enum expected

Can U please post the error what u get
Reputation Points: 10
Solved Threads: 1
Newbie Poster
seenukarthi is offline Offline
2 posts
since May 2006
Aug 14th, 2007
0

Re: class, interface, or enum expected

sure....
class, interface, or enum expected
[javac] public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mimsc is offline Offline
70 posts
since Aug 2007
Aug 14th, 2007
0

Re: class, interface, or enum expected

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:
Java Syntax (Toggle Plain Text)
  1. public class MyClassName
  2. {
  3. public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
  4. /**
  5. *
  6. *all codes inside
  7. */
  8. }
  9. }
Reputation Points: 46
Solved Threads: 11
Junior Poster
orko is offline Offline
164 posts
since Apr 2006
Aug 15th, 2007
0

Re: class, interface, or enum expected

thanx
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mimsc is offline Offline
70 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Help!!! Help!!! Help!!!
Next Thread in Java Forum Timeline: Filter JTextField and Display in JTable





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC