JSP: Data retrieval from database
Hi Everyone...
I know that inorder to extract a value from a database and output to the screen the syntax will be
<%= rst.getString("DeliveryID")%>.
But what if I want to extract the value from the database and instead of outputting to the screen, I want to assign it to a variable I have declared.
I tried the following but it did not work:
<% String name = request.getString("DeliveryID"); %>.
I hope someone can help me out in this.
regards
BabyJava
[521 byte] By [
BabyJavaa] at [2007-11-26 21:12:04]

@OP: a jsp should just concentrate on the view, i.e. the html to beproduced. Never should it have to deal with databases. Recheckyour design.kind regards,Jos
Hi Guys...
Really thanks for the advice, I guess you guys are right. But it's too late for me to change anything now so I am more or less stuck with the existing design. I have got one new problem though.
I want to update all values of a table at once and this is the SQL statement I used, but it's not working. I guess the problem could be with the way I am using the wildcard. Here is the code:
String query = " UPDATE Customer SET CustomerID = '"+CustID +"'," +
" CustomerName = '"+CustName+"', CustomerPassword = '"+CustPassword+"', " +
" CustomerType = '"+CustType+"' , CustomerAddress = '"+CustAddress+"' ," +
" CustomerHandphone = '"+CustHandphone+"'" +
" WHERE CustomerID LIKE 'C%' ";
I am getting a general error. Is there anything wrong with my code?
regards
BabyJava