aspose file tools*
The moose likes JSP and the fly likes Error  occured while initialising for loop: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Error  occured while initialising for loop:" Watch "Error  occured while initialising for loop:" New topic
Author

Error occured while initialising for loop:

Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi;
The bellow page shows the error at marked line as:can not find symbol count as i initialised before it:
kindly suggest modification




Thanks in advance
regards
Harshal
[ July 25, 2008: Message edited by: Harshal Gurav ]
Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
The count variable is declared in the try block just before the bold line, hence it's not visible in that exact line.
Declare the int count variable just before the opening try and you'll get your code to run.
Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi Matteo;
Thank for your reply, after modifieng the code it shows erro in 4-count sql syntax asperator + can not applied to java.lang.string,QNO.
Thanks and Regards
Harshal
Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
Hm, can you provide the new source code and the exact error message ? I'm not completely sure about what's the next problem here. I see some problems in code which will probably come out after solving this one. For example, after setting some parameter like in



you should leave a blank space after the closing ', else you'll get SQL exceptions.
But regarding this very error (count sql syntax) I need to check the source code and the exact error message.
Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi matteo,
Thanks for your valuable suggestion.
In the below code I am getting output with no. of question only 8 which is first 8 in table while i am firing query for all 22 question. also gets count=22 so no error in for statement an i am peinting count value for checking.
2. I am getting count for all count query as 0.
Here is an updated code:


Here is output that i am getting


6 1 22 Question: How difficult did you find the course?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: How much outside work per week (excluding time spent in attending lectures) did the course entail?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: How easily were the books and articles recommended in the class available in the library?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: How useful did you find the suggested readings?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: Do you think a sufficient number of quizzes/exams were given?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: How helpful were the quizzes/exams?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: How fair were the exams (that counted towards your grade) testing your knowledge of the course material?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0

Question: Was classroom participation encouraged?
No. of A: 0 No. of B: 0 No. of C: 0 No. of D: 0




Any suggestion is highly appreciated
Thanks and Regards
Harshal
Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
I suppose the where clauses in the select queries are excluding some of the results you desire to show. For example :



questionid and answer should bind all the B votes to this question, then why do you include a check for eventid and questionname values too ?
You might want to describe a bit your tables (Final and Questionbank) and tell us how they're bound together, especially including the meaning of the field "Questionname" (which if I don't misunderstood should be an int value).
Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi matteo,
Kindly refer the updated code that i had posted befor this post where i changed the name of colunm questionname as qserialno which is one column of table final.
In Questionbank table i have questionid as id for perticular type of question. one questionid may include several Qserialno.as no.of question related to that questionid.
1. I am finding no fo question filled in final table as i can get count of no.of question.
2.There is same data in eventid,questionid,Qserialno. column in both this table(Questionbank and final)
3. i am getting questionid and eventid from previous form. here i assumed int QNO = Qserialno. avilable in table and I am looping it.
so QNO increases rs will be point to next row.

I am not sure about where QNO.is looping or not?
Thanks and Regards
Harshal
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error occured while initialising for loop: