Share via


setObject Method (int, java.lang.Object)

Sets the value of the designated parameter by using the given object.

public final void setObject(int index,
                            java.lang.Object obj)

Parámetros

index

An int that indicates the parameter number.

obj

An object.

Excepciones

SQLServerException

Notas

This setObject method is specified by the setObject method in the java.sql.PreparedStatement interface.

Before calling this setObject method, the application might set the specified parameter by using one of the following methods:

  • The set<Type> methods of the SQLServerPreparedStatement class or the SQLServerCallableStatement class

  • The setNull methods of the SQLServerPreparedStatement class or the SQLServerCallableStatement class

  • The registerOutParameter method of the SQLServerCallableStatement class

In such a case, the type of the parameter is automatically set. If the application calls this setObject method with an obj value NULL, the driver assumes that the type of the parameter is one that is set by the previously called method.

If the obj value is NULL and no type information for that parameter can be determined, this setObject method converts the specified parameter to a CHAR before sending it to the database.

Vea también

Referencia

SQLServerPreparedStatement Class

Conceptos

setObject Method (SQLServerPreparedStatement)
SQLServerPreparedStatement Methods
SQLServerPreparedStatement Members