Κοινή χρήση μέσω


Test for a null value

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

The following code example shows how to test for a null value by using the FilterExpression and QueryByAttribute classes.

Example

Use this code to test for equality by using the FilterExpression class.

FilterExpression null_filter = new FilterExpression(LogicalOperator.And); 
null_filter.FilterOperator = LogicalOperator.And; 
null_filter.AddCondition("leadid", ConditionOperator.Null);

Example

Use this code to test for inequality by using the FilterExpression class.

FilterExpression filter = new FilterExpression(LogicalOperator.And); 
filter.FilterOperator = LogicalOperator.And; 
filter.AddCondition("leadid", ConditionOperator.NotNull);

Example

Use this code to test for equality by using the QueryByAttribute class.

QueryByAttribute qba = new QueryByAttribute("account"); 
qba.ColumnSet = new ColumnSet("name","address1_stateorprovince"); 
qba.AddAttributeValue("donotfax", null);

See Also

Build queries with QueryExpression
Page large result sets with QueryExpression

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright