IConnection.PrepareStatement Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| PrepareStatement(String) |
Creates a <code>PreparedStatement</code> object for sending parameterized SQL statements to the database. |
| PrepareStatement(String, Int32) |
Creates a default <code>PreparedStatement</code> object that has the capability to retrieve auto-generated keys. |
| PrepareStatement(String, Int32[]) |
Creates a default <code>PreparedStatement</code> object capable of returning the auto-generated keys designated by the given array. |
| PrepareStatement(String, String[]) |
Creates a default <code>PreparedStatement</code> object capable of returning the auto-generated keys designated by the given array. |
| PrepareStatement(String, Int32, Int32) |
Creates a <code>PreparedStatement</code> object that will generate <code>ResultSet</code> objects with the given type and concurrency. |
| PrepareStatement(String, Int32, Int32, Int32) |
Creates a <code>PreparedStatement</code> object that will generate <code>ResultSet</code> objects with the given type, concurrency, and holdability. |
PrepareStatement(String)
Creates a <code>PreparedStatement</code> object for sending parameterized SQL statements to the database.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_Handler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_Handler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
an SQL statement that may contain one or more '?' IN parameter placeholders
Returns
a new default <code>PreparedStatement</code> object containing the pre-compiled SQL statement
- Attributes
Exceptions
if there is a problem accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PrepareStatement(String, Int32)
Creates a default <code>PreparedStatement</code> object that has the capability to retrieve auto-generated keys.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;I)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql, int autoGeneratedKeys);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;I)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string * int -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
an SQL statement that may contain one or more '?' IN parameter placeholders
- autoGeneratedKeys
- Int32
a flag indicating whether auto-generated keys should be returned; one of <code>Statement.RETURN_GENERATED_KEYS</code> or <code>Statement.NO_GENERATED_KEYS</code>
Returns
a new <code>PreparedStatement</code> object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
- Attributes
Exceptions
if there is a problem accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String, int).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PrepareStatement(String, Int32[])
Creates a default <code>PreparedStatement</code> object capable of returning the auto-generated keys designated by the given array.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;[I)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_arrayIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql, int[]? columnIndexes);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;[I)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_arrayIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string * int[] -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
an SQL statement that may contain one or more '?' IN parameter placeholders
- columnIndexes
- Int32[]
an array of column indexes indicating the columns that should be returned from the inserted row or rows
Returns
a new <code>PreparedStatement</code> object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes
- Attributes
Exceptions
if a problem occurs accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String, int[]).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PrepareStatement(String, String[])
Creates a default <code>PreparedStatement</code> object capable of returning the auto-generated keys designated by the given array.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_arrayLjava_lang_String_Handler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql, string[]? columnNames);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_arrayLjava_lang_String_Handler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string * string[] -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
an SQL statement that may contain one or more '?' IN parameter placeholders
- columnNames
- String[]
an array of column names indicating the columns that should be returned from the inserted row or rows
Returns
a new <code>PreparedStatement</code> object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names
- Attributes
Exceptions
if a problem occurs accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String, java.lang.String[]).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PrepareStatement(String, Int32, Int32)
Creates a <code>PreparedStatement</code> object that will generate <code>ResultSet</code> objects with the given type and concurrency.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql, int resultSetType, int resultSetConcurrency);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string * int * int -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
a <code>String</code> object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
- resultSetType
- Int32
a result set type; one of <code>ResultSet.TYPE_FORWARD_ONLY</code>, <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
- resultSetConcurrency
- Int32
a concurrency type; one of <code>ResultSet.CONCUR_READ_ONLY</code> or <code>ResultSet.CONCUR_UPDATABLE</code>
Returns
a new PreparedStatement object containing the pre-compiled SQL statement that will produce <code>ResultSet</code> objects with the given type and concurrency
- Attributes
Exceptions
if a problem occurs accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String, int, int).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PrepareStatement(String, Int32, Int32, Int32)
Creates a <code>PreparedStatement</code> object that will generate <code>ResultSet</code> objects with the given type, concurrency, and holdability.
[Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;III)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IIIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IPreparedStatement? PrepareStatement (string? sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability);
[<Android.Runtime.Register("prepareStatement", "(Ljava/lang/String;III)Ljava/sql/PreparedStatement;", "GetPrepareStatement_Ljava_lang_String_IIIHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PrepareStatement : string * int * int * int -> Java.Sql.IPreparedStatement
Parameters
- sql
- String
a <code>String</code> object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
- resultSetType
- Int32
one of the following <code>ResultSet</code> constants: <code>ResultSet.TYPE_FORWARD_ONLY</code>, <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
- resultSetConcurrency
- Int32
one of the following <code>ResultSet</code> constants: <code>ResultSet.CONCUR_READ_ONLY</code> or <code>ResultSet.CONCUR_UPDATABLE</code>
- resultSetHoldability
- Int32
one of the following <code>ResultSet</code> constants: <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
Returns
a new <code>PreparedStatement</code> object, containing the pre-compiled SQL statement, that will generate <code>ResultSet</code> objects with the given type, concurrency, and holdability
- Attributes
Exceptions
if a problem occurs accessing the database.
Remarks
Java documentation for java.sql.Connection.prepareStatement(java.lang.String, int, int, int).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.