How to pass query as parameter?

Ads
 

How to pass query as parameter?

Hi Friends,

I have a real tough time in finding the solution of a problem. I am here to find a real solution of my problem. Please help me solve this problem.
My Problem is:

I have 3 query..
String qry1="select id from table1";
String qry2="select name from table2";
String qry3="select age from table13";

string q=Insert into emp values(?,?,?);
int update=prep.executeUpdate(q);
prep.setString(1,qry1);
prep.setString(2,qry2);
prep.setString(3,qry3);
prep.executeUpdate();

In this, i am not able to pass the value of qry1,qry2,qry3...

Please help me to find the solution.

Its really urgent.......Please
View Answers

Ads









Related Tutorials/Questions & Answers:
how to debug parameters in the hibernate query
how can we pass parameters from jsp href to another servlet
Advertisements
How to pass query as parameter? - JSP-Servlet
Pass parameters from JSP to Servlet
How to pass and catch HTML parameters to a Java program using REST services?(without using servlet/jsp)
Passing Parameters in jsp
write a program to demonstrate call by value and call by reference.(pass objects as parameters)
how to pass the parameter in callable statement
How to pass value of a link to a textfield
How do you pass a variable by value?
how to pass command line arguments in ant
How to pass javascript variable in Scriplet of JSP?
How do I find out the number of parameters passed into function9. ?
how many max. arguments we pass to the any function ? how many max. arguments we pass to the any function ?
How to pass an arraylist from servlet to jsp?
How to pass multiple values from a servlet to JSP?
In Struts 2 how to pass the <s: property value=''
How to pass command line arguments in Java?
Can anybody tell me how to use #parameters in struts 2 ?
How to pass value from dijit.Tree to dijit.MenuItem - Ajax
How to pass the value from controller to jsp page ?
how to pass class variable to another class
[JSP] How to pass back ID to previous page.
How can I get the full URL with the attached parameters? - JSP-Servlet
how to pass a string from one class to another
How can i pass the valus from a JSP to the action class???
how many max. arguments we pass to the any function ?
How to create wildcard query in Hibernate?
SQL IN Parameters
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to use group by in nested query

Ads