共用方式為


+ (String Concatenation) (Entity SQL)

Concatenates two strings.

expression + expression

Arguments

  • expression
    Any valid expression of the System.Char and System.String data types. Both expressions must be of the same data type, or one expression must be able to be implicitly converted to the data type of the other expression.

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).

Example

The following Entity SQL query uses the + operator to concatenates two strings. 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 PrimitiveType Results (EntityClient).

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

SELECT VALUE 'Name=[' + e.Name + ']' FROM 
    AdventureWorksEntities.Product AS e

The output is shown below:

Value: Name=[Adjustable Race]
Value: Name=[All-Purpose Bike Stand]
Value: Name=[AWC Logo Cap]
Value: Name=[BB Ball Bearing]
Value: Name=[Bearing Ball]

See Also

Concepts

Operators (Entity SQL)

Other Resources

String Concatenation Operator