Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resultset

 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jdbc connectivity with java....i want to retrieve values of resultset so that i can use these values outside the loop .....please help me...
By using following statement more than one rows are retrieved .....
I want to display different values of a,b,c and d in table in pdf .how can we do this......
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
archana tiwari wrote:please write the code so that my problem can be solved

No. We are NotACodeMill. We will assist you in finding the solution, but we will not write your code for you.

What happens if you move the part that adds these cells inside your while loop?
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:
archana tiwari wrote:please write the code so that my problem can be solved

No. We are NotACodeMill. We will assist you in finding the solution, but we will not write your code for you.

What happens if you move the part that adds these cells inside your while loop?


more than one tables are generated according to the number of times while loop is executing...
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then don't add the table creating code to the loop. Instead do this (pseudo code):
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Then don't add the table creating code to the loop. Instead do this (pseudo code):



I am not getting what you are trying to say....please tell me in detail.....
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Then don't add the table creating code to the loop. Instead do this (pseudo code):


This code is working but underlined part is giving error....in first column i have to print 1,2,3 .but auto increment is not working.what should i do?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to print incremental numbers then don't reset i to 1 in each iteration.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:If you want to print incremental numbers then don't reset i to 1 in each iteration.

but int i is giving error because The method addCell(PdfPCell) in the type PdfPTable is not applicable for the arguments (int).so what should i use?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing to do is to move the "int i=1" outside of the loop.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:The first thing to do is to move the "int i=1" outside of the loop.

I have checked it also .. i have put int i=1 outside the loop
but table.addCell(i); is giving error.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no method PdfPTable.addCell(int) - what made you think there is? If you want to add the value of i as a string then the easiest way is to construct a String from i and call PdfPTable.addCell(String).
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:There is no method PdfPTable.addCell(int) - what made you think there is? If you want to add the value of i as a string then the easiest way is to construct a String from i and call PdfPTable.addCell(String).


but using string we can not increment it to 1 then 2 then 3 we get 1 then 11 then 111 by concatenating the string.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't say you should increment a string, I said you should convert the int to a string when calling the PdfPTable.addCell method.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I didn't say you should increment a string, I said you should convert the int to a string when calling the PdfPTable.addCell method.

thanks ...problem is solved....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic