This week's book giveaway is in the
General Computing
forum.
We're giving away four copies of
Arduino in Action
and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
resultset is not working properly
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
I like...
posted
Jul 16, 2011 05:39:33
0
Hi all,
I have following code... what is the problem in this it is fetching value only second query
stmt=(Statement)con.createStatement(); sql="Select society_name,appartment_no,grid_last_units,dg_last_units from resident_elec_bill_ref where society_name='"+elec_id+"'"; rs=stmt.executeQuery(sql); System.out.println("qry is:: "+sql); if(rs.next()){ do{ bn=true; socs=rs.getString(1); apt_no=rs.getString(2); lgridunit=rs.getString(3); lastdgunit=rs.getString(4); System.out.println("Society Name is === "+socs); System.out.println("Appartment NO is ==== "+apt_no); System.out.println("Grid unit is ==== "+lgridunit); System.out.println("DG unit is ==== "+lastdgunit); }while(rs.next()); } stmt=(Statement)con.createStatement(); sql1="Select * from appartment where society_name='"+elec_id+"'"; rs=stmt.executeQuery(sql1); System.out.println("Query second is " + sql1); while(rs.next()){ bn=true; socs=rs.getString(3); apt_no=rs.getString(6); lgridunit=rs.getString(20); lastdgunit=rs.getString(21); %> <tr> <input type="hidden" name="society_name" value="<%=socs%>"> <td align="center" class="centerfont" width="12%"> <input type="text" size="10" name="flat_no" value="<%=apt_no%>"></td> <td align="center" width="18%"> <input type="text" size="14" name="grid_last_unit" value="<%=lgridunit%>"></td> <td align="center" width="18%"> <input type="text" size="14" name="grid_new_unit" value=""></td> <td align="center" width="18%"> <input type="text" size="14" name="dg_last_unit" value="<%=lastdgunit%>"></td> <td align="center" width="18%"> <input type="text" size="14" name="dg_new_unit" value=""></td> <!--td align="center"> <input type="button" name="button" class="button" value="Report" onclick="//return showBill('<%//=rs.getString(2)%>')"></td--> </tr> <% } %>
I have value in resident_ele_bill_ref but it is not taking that values...
please tell me what is the wrong in this code...
Thanks
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
78
I like...
posted
Jul 16, 2011 18:46:00
0
closing accidental duplicate:
http://www.coderanch.com/t/545634/JDBC/java/resultset-not-working-properly
[
Blog
] [
JavaRanch FAQ
] [
How To Ask Questions The Smart Way
] [
Book Promos
]
Blogging on Certs:
SCEA Part 1
,
Part 2 & 3
,
Core Spring 3
,
OCAJP
,
OCPJP beta
,
TOGAF part 1
and
part 2
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: resultset is not working properly
Similar Threads
How to set timer for select the time am to pm on front end in a jsp page like calender for date?
how to getSession in simple java class?
How to update a image using servlet?
resultset is not working properly
getParameters names from jsp?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter