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

problem solved...

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.

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.