Image

Imagemilissa wrote in Imagejava_dev

Clarification on Scope and Visibility Question Part One

Okay, I hope this is understandable.

In the servlet there are 3 queries running. There is only one process of the result set for all three result sets. The first rs (rs1) retrieves a value from the database and adds 1 to it this result becomes int1.

The second rs (rs2) gets int1 and checks to see if it is divisible by 3 to set int2 to zero if true or to the value of int1 if false.

The third rs (rs3) gets a value from the db and adds it to a value taken from the previous page. It then has to check to see to see if the sum of those to values is great than or less than 500 depending on the answer a third boolean value is set to either 1 or 2.

The fourth rs (rs4) was created to write the information back to the database the
"Insert into orders (orderid, orderdate, status, totalcost, cardtype, expiration, quanity, isbn, fname, lname, company, address2, city, state, zipcode, cardnumber, address1) values ("+ orderid +", '"+ sysDate +"', "+ intqoh +", "+ Total +", '"+ cardnumber +"', "+ expdate +", "+ quanity +", '"+ isbn +"', '"+ firstname +"', '"+ lastname +"', '"+ company +"', '" + address2 + "', '"+ city +"', '" + state +"', " + zipcode +", "+ cardnumber +", '"+ address1 +"')";



Since this query is being created and initialized in the do get the values to be put into the query are created and intialized in the process of the result set which places them out of scope.