Ask Question
24 January, 12:29

Suppose a prepared statement is created as follows.

PreparedStatement ps = conn. prepareStatement

("insert into Student (fName, mi, lName) values (?,?,?) ");

To assign the value John to the first parameter of this query, use

ps. setString (1, "John");.

ps. set (1, "John");.

ps. setString (0, "John");.

ps. set (0, "John");.

+5
Answers (1)
  1. 24 January, 14:13
    0
    The correct answer for the given question is ps. setString (1, "John");.

    Explanation:

    Prepared statement are used in java programming language. Prepared statement are the interface they increases the performance i. e query run faster.

    According to the question we have to assign the value of first parameter i. e "fName" as "fname" is a string that means we have to set a string parameter so following query will be used ps. setString (1, "John");. This statement specify the first parameter in the query. The setString () method set the string along with the position and the value of string. If we have to set integer parameter then we have to use "setInt () " along with position and the value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Suppose a prepared statement is created as follows. PreparedStatement ps = conn. prepareStatement ("insert into Student (fName, mi, lName) ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers