Records In JSp & backend Differ ??
Posted: Nov 5, 2003 11:03 PM
Advertisement
Hi, I have a strange problem. Im executing a database query that returns 1 record in jsp( using ResultSet.next()) where as when i execute same query in backend i get two recods .can anyone tell me why?? thaks rgds Birendar S Waldiya the jsp code that process the query is :- <code> while(fetchRS.next()) { if(subTotalReq && !firstLoop && !tempValue.equals(fetchRS.getString(1))){ tempParam = " and " + Columns.get(0).toString() + "$'" + tempValue+"'"; tempHeader = Headings.get(0).toString() + ":" + tempValue; out.println("<tr>"); out.println("<td class=\"TrtblS_la\" style=\"background-color:silver\" colspan=\"2\"><b>SUB Total For "+tempValue+"</b></td>"); out.println("<td class=\"TrtblC_ra\" style=\"background-color:silver\" colspan=\""+(columnsCount-2)+"\"><a class=\"DLnk\" href=\""+calledPage+"?parameters="+tempParam.replace('&','^').replace('+',' |'). replace('%','~')+"&headers="+tempHeader.replace('&','^').replace('+','| ')+"&cond ition="+condition.toString().replace('%','~').replace('&','^').replace('+', '|')+ "&searchBy="+searchBy+"&exp_from_date="+exp_from_date+"&exp_to_date ="+exp_to_dat e+"&from_month="+from_month+"&to_month="+to_month+"\"><strong> "+formatt er.format(subTotal)+"</strong></a></td>"); out.println("< /tr>"); pageContent.append("\n"); pageContent.append("Sub Total For "+tempValue+"\t"+tabs+formatter.format(subTotal)); subTotal = 0; } pageContent.append("\n"); parameters = new StringBuffer(); headers = new StringBuffer(); out.println("<tr>"); for(int j =0; j< columnsCount; j++) { if( j == columnsCount-1){ out.println("<td class=\"TrtblC_ra\" colspan=\"1\"><a class=\"DLnk\" href=\""+calledPage+"?parameters="+(parameters.toString()).replace('&','^') .rep lace('+','|').replace('%','~').replace('"','*')+"&headers="+headers.toStrin g().r eplace('&','^').replace('+','|')+"&condition="+condition.toString().rep lace('%', '~').replace('&','^').replace('+','|')+"&searchBy="+searchBy+"&exp_ from_date="+e xp_from_date+"&exp_to_date="+exp_to_date+"&from_month="+from_month+" 8;to_month="+ to_month+"\">"+formatter.format(fetchRS.getDouble(j+1))+"</a></td&g t; ;"); totalINR = totalINR + fetchRS.getDouble(j+1); subTotal = subTotal + fetchRS.getDouble(j+1); pageContent.append(formatter.format(fetchRS.getDouble(j +1))+"\t"); }else{ out.println("<td class=\"TrtblS_la\" colspan=\"1\">"+fetchRS.getString(j+1)+"</td>"); pageContent.append(fe tchRS.getString(j+1)+"\t"); if((Columns.get(j).toString()).equals("PROJ_DESCRIPT ION")){ parameters.append(" and "+Columns.get(j)+" like'"+fetchRS.getString(j+1).replace('"','*')+"%'"); }else{ if((Columns.get(j) .toString()).equalsIgnoreCase("CUSTOMER_NAME")){ parameters.append(" and customer_id $'"+fetchRS.getString("customer_id")+"'"); }else{ parameters.append(" and "+Columns.get(j)+"$'"+fetchRS.getString(j+1)+"'"); } }//end if headers.append(" "+Headings.get(j)+"$"+fetchRS.getString(j+1)+(j%2==0?"<BR>":" ")); }//End of IF }// End of For out.println("</tr>"); recCount++; tempValue = fetchRS.getString(1); firstLoop = false; }//END OF WHILE </code>