0

hi!!!

i have got a small problem wid an sql query that i m writting in jsp

the query is real simple... but i dont know y m not gettin it...

q="select '" +col+ "'  from  '" +ta+ "'";
     Class.forName(sq.getName());
     cn=DriverManager.getConnection(sq.getConnstr(),sq.getUser(),sq.getPwd());
     st=cn.prepareStatement(q);
     out.println("before query1");
     rst=st.executeQuery();
q="select ? from ?";
Class.forName(sq.getName());
     cn=DriverManager.getConnection(sq.getConnstr(),sq.getUser(),sq.getPwd());
     st=cn.prepareStatement(q);
     st.setString(1,col);
     st.setString(2,ta);
     out.println("before query1");
     rst=st.executeQuery();

both r not workin...

can you tell me how to write such a query where i want a single column values of a table where both tablename n columnname r not directly placed in the query...??


thank u in advance

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by rockersmith
0

Properties driver, url user password required to connect to the database include the name. <sql:query> Use JSTL tags can read data from the database. Code register table record corresponding values in return and print your browser.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.