Ask Question
13 June, 14:32

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");.

+1
Answers (1)
  1. 13 June, 16:31
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers