hi
i am displaying DATA retreived from the backend sql in table format.
select col1,col2,col3..... from table1.

Now i want to store col2,col3 in an array .and i want to add col2 and col3 values and display the result in col4.
col1,col2,col3 are retrived from the database.

please give me the code which performs the same. its urgent

Thanks in advance

regards
Akash

>its urgent
It is not urgent to us, we have our own lifes too

>please give me the code which performs the same
Why sould we do so? For once you should read this important post.
Next to solution, no I will not write code for you I will give you idea what to do.
In SQL there is a query which is able to return row count which will tell you what the size array gone be. Create and initialize array. Run a query to retrive data from field you want, parse if neccessary, and store it in array. You may wish to create 2 dimensional array or you can create two arrays which is absolutely up to you.

Magic is revealed, now is up to you to do your job...

hi
thanks for the advise,the values in the column are not there in the database.if values exists in the database i can do that easily, i already did like that for other table.

the values in last 2 columns are externaly added to the table.
how to add this last 2 columns and place the result in new column.

Regards
Akash

for(int i = 0; i < arrayCol2.lenght; i++)
{
     arrayCol4[i] = arrayCol2[i] + arrayCol3[i];
}

Taking in account that col2 and col3 been already retrived from database and stroed in they arrays, plus before for loop col4 was already initialized

hi
Thanks for u r effort and code.

col1, col2, col3 col4 col5 col6
x 1234 234 2 3
y 2345 346 3 4

the values in col1, col2 col3 are retreived from the database using the query select.....
the values in col4,col5 are entered by taking substrings of values in col2 and col3.

here is the code :

now i want to add col4 + col5 and display the result in col6.<td align="right" ><%= rs.getString("RelID") %></td>
<td align="right" ><%= rs.getString("prodNum") %></td>
<td align="center"><%= rs.getString("IntroPhase") %></td>
<td align="center"><%= rs.getString("Whereincode") %></td>
<td align="center"><%= rs.getString("WhereinDocument") %></td>
<td align="center"><%= rs.getString("WhichBuild") %></td>
<td align="center"><%= rs.getString("Owner") %></td>
col4=<td align="center"><%= rs.getString("mon").substring(5,7) %</td>
col5=<td align="center"><%= rs.getString("year").substring(3,5) %</td>

Regards
Akash

There is no need for 2 threads with the same question. If you are unsure as to how to do col4 + col5 that is a bit of a worry. Remember you are using JSP (i.e. java).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.