Con. Execute parameter explanation-and implementation of "Modify if there is, insert if there is no"

Source: Internet
Author: User

Commandtext, recordsaffected, options
Parameters
A commandtext string that contains the SQL statement, table name, stored procedure, or text of a specific provider.
Recordsaffected (optional) number of records affected by the operation returned by the provider for a long integer variable.
Options (optional) long integer value, indicating how the provider calculates the commandtext parameter. The following values can be used:
Constant description
Adshorttext indicates that the provider should calculate commandtext according to the command text definition.
Adcmdtable indicates that ADO should generate an SQL query so that all rows can be returned from the commandtext table.
Adcmdtabledirect instructs the provider to return all rows from the commandtext table.
Adcmdtable indicates that the provider should calculate commandtext Based on the table name.
Adcmdstoredproc indicates that the provider should calculate commandtext Based on the stored procedure.
Adcmdunknown indicates that the command type in commandtext is unknown.
Adasyncexecute indicates that the command should be executed asynchronously.
Adasyncfetch indicates the asynchronous extraction of the remaining rows after the initial quantity specified by the cachesize attribute.

 

====================

 

Recordsaffected is of the [out] type. Returns the number of rows affected by this operation.

 

This is useful when processing changes if they exist and inserts if they do not exist.

Example:

Int affected = 0;

Con. Execute (L "Update...", & affected); // because update does not produce a primary key constraint error, update first

If (affected = 0)

Con. Execute (L "insert ")

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.