Navigation:  Advantage .NET Data Provider > AdsDataAdapter Class > AdsDataAdapter Properties >

AdsDataAdapter.UpdateCommand

Advantage .NET Data Provider

Previous pageReturn to chapter overviewNext page

Gets or sets an SQL statement or stored procedure used to update records in the data source.

public AdsCommand UpdateCommand { get; set; }

Remarks

During Update, if this property is not set and primary key information is present in the DataSet, the UpdateCommand can be generated automatically if you set the AdsDataAdapter.SelectCommand property and use the AdsCommandBuilder. Then, any additional commands that you do not set are generated by the AdsCommandBuilder.

When UpdateCommand is assigned to a previously created AdsCommand, the AdsCommand is not cloned. The UpdateCommand maintains a reference to the previously created AdsCommand object.

Note If execution of this command returns rows (e.g., from a stored procedure), the updated rows may be merged with the DataSet depending on how you set the AdsCommand.UpdatedRowSource.

 

Note In the WHERE clause of the Update Command, it is not necessary to check for NULL conditions in the parameters explicitly in the statement. Advantage will correctly handle the comparison for parameters that have a NULL value. In fact, Advantage will not allow a parameter to be on the left-hand side of an operator.

The following is a valid UPDATE command for an SqlDataAdapter:

UPDATE Sample SET LastName = @p1, FirstName = @p2 WHERE ( (ID = @p3) AND ((LastName IS NULL AND @p4 IS NULL)

OR (LastName = @p5)) AND ((FirstName IS NULL AND @p6 IS NULL) OR (FirstName = @p7)) )

The analogous UPDATE command for the AdsDataAdapter would look like this:

UPDATE Sample SET LastName = :p1, FirstName = :p2 WHERE ( (LastName = :p3)) AND (FirstName = :p4))

 

See Also

AdsCommandBuilder