Share via


ICallableStatement.SetObject Method

Definition

Overloads

SetObject(String, Object)

Sets the value of the designated parameter with the given object.

SetObject(String, Object, Int32)

Sets the value of the designated parameter with the given object.

SetObject(String, Object, Int32, Int32)

Sets the value of the designated parameter with the given object.

SetObject(String, Object)

Sets the value of the designated parameter with the given object.

[Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_Handler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetObject (string? parameterName, Java.Lang.Object? x);
[<Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_Handler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetObject : string * Java.Lang.Object -> unit

Parameters

parameterName
String

the name of the parameter

x
Object

the object containing the input parameter value

Attributes

Exceptions

if a database error occurs.

Remarks

Sets the value of the designated parameter with the given object. The second parameter must be of type Object; therefore, the java.lang equivalent objects should be used for built-in types.

The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument will be converted to the corresponding SQL type before being sent to the database.

Note that this method may be used to pass datatabase- specific abstract data types, by using a driver-specific Java type.

If the object is of a class implementing the interface SQLData, the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref, Blob, Clob, NClob, Struct, java.net.URL, or Array, the driver should pass it to the database as a value of the corresponding SQL type.

This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.

<b>Note:</b> Not all databases allow for a non-typed Null to be sent to the backend. For maximum portability, the setNull or the setObject(String parameterName, Object x, int sqlType) method should be used instead of setObject(String parameterName, Object x).

Added in 1.4.

Java documentation for java.sql.CallableStatement.setObject(java.lang.String, java.lang.Object).

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.

See also

Applies to

SetObject(String, Object, Int32)

Sets the value of the designated parameter with the given object.

[Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;I)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_IHandler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetObject (string? parameterName, Java.Lang.Object? x, int targetSqlType);
[<Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;I)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_IHandler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetObject : string * Java.Lang.Object * int -> unit

Parameters

parameterName
String

the name of the parameter

x
Object

the object containing the input parameter value

targetSqlType
Int32

the SQL type (as defined in java.sql.Types) to be sent to the database

Attributes

Exceptions

if a database error occurs.

Remarks

Sets the value of the designated parameter with the given object. This method is like the method setObject above, except that it assumes a scale of zero.

Added in 1.4.

Java documentation for java.sql.CallableStatement.setObject(java.lang.String, java.lang.Object, 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.

See also

Applies to

SetObject(String, Object, Int32, Int32)

Sets the value of the designated parameter with the given object.

[Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;II)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_IIHandler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetObject (string? parameterName, Java.Lang.Object? x, int targetSqlType, int scale);
[<Android.Runtime.Register("setObject", "(Ljava/lang/String;Ljava/lang/Object;II)V", "GetSetObject_Ljava_lang_String_Ljava_lang_Object_IIHandler:Java.Sql.ICallableStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetObject : string * Java.Lang.Object * int * int -> unit

Parameters

parameterName
String

the name of the parameter

x
Object

the object containing the input parameter value

targetSqlType
Int32

the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.

scale
Int32

for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored.

Attributes

Exceptions

if a database error occurs.

Remarks

Sets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, the java.lang equivalent objects should be used.

The given Java object will be converted to the given targetSqlType before being sent to the database.

If the object has a custom mapping (is of a class implementing the interface SQLData), the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref, Blob, Clob, NClob, Struct, java.net.URL, or Array, the driver should pass it to the database as a value of the corresponding SQL type.

Note that this method may be used to pass datatabase- specific abstract data types.

Added in 1.4.

Java documentation for java.sql.CallableStatement.setObject(java.lang.String, java.lang.Object, 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.

See also

Applies to