Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 jsp variable use

Author  Topic 

shilpa.joshiv
Starting Member

3 Posts

Posted - 2009-12-04 : 04:45:19
i m writing the following query as an jsp code..
<%
String Query="select * from product_details where zone_name='jsp_var1' ";
%>
the value of jsp_var1 is already defined and it is of type String only
but this query is not taking the value of jsp_var1...
what to do????????
plzzzzzzz help

kbhere
Yak Posting Veteran

58 Posts

Posted - 2009-12-04 : 04:59:45
<%
String Query="select * from product_details where zone_name = '" +jsp_var1+ "' ";
%>

Try this and reply with your comments..

Balaji.K
Go to Top of Page

shilpa.joshiv
Starting Member

3 Posts

Posted - 2009-12-04 : 06:22:19
absolutely rite..........
itz working
thanx a lot....
Go to Top of Page

kbhere
Yak Posting Veteran

58 Posts

Posted - 2009-12-04 : 06:32:35
quote:
Originally posted by shilpa.joshiv

absolutely rite..........
itz working
thanx a lot....



Ok.. You are always welcome..


Balaji.K
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-04 : 07:27:00
quote:
Originally posted by shilpa.joshiv

i m writing the following query as an jsp code..
<%
String Query="select * from product_details where zone_name='jsp_var1' ";
%>
the value of jsp_var1 is already defined and it is of type String only
but this query is not taking the value of jsp_var1...
what to do????????
plzzzzzzz help


Because it is treated a value as your query becomes

select * from product_details where zone_name='jsp_var1'

It is better you use parameter instead of concatenating the value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -