共用方式為


+ (Add) (Entity SQL)

Adds two numbers.

expression + expression

Arguments

  • expression
    Any valid expression of any one of the numeric data types.

Result Types

The data type that results from the implicit type promotion of the two arguments. For more information about implicit type promotion, see Type System (Entity SQL).

Remarks

For System.String types, addition is concatenation.

Example

The following Entity SQL query uses the + arithmetic operator to add two numers. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:

  1. Follow the procedure in How to: Execute a Query that Returns StructuralType Results (EntityClient).

  2. Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

SELECT VALUE product FROM AdventureWorksEntities.Product AS product 
    where product.ListPrice = 120 + 5

The output is shown below:

ProductID: 842
Name: Touring-Panniers, Large
ProductNumber: PA-T100
MakeFlag: False
...

See Also

Concepts

Entity SQL Reference

Other Resources

Arithmetic Operators