14. Dezember 2009 15:48
Dim cols As New ColumnSet()
' Set the properties of the ColumnSet.
cols.Attributes = New String() {"name", "accountid", "accountnumber"}
' Create the ConditionExpression.
Dim condition As New ConditionExpression()
' Set the condition for the retrieval to be when the contact's address' city is Sammamish.
[b] condition.AttributeName = "accountnumber"
condition.Operator = ConditionOperator.Like
condition.Values = New String() {"1000"}[/b]
' Create the FilterExpression.
Dim filter As New FilterExpression()
' Set the properties of the filter.
filter.FilterOperator = LogicalOperator.And
filter.Conditions = New ConditionExpression() {condition}
' Create the QueryExpression object.
Dim query As New QueryExpression()
' Set the properties of the QueryExpression object.
query.EntityName = EntityName.account.ToString()
query.ColumnSet = cols
query.Criteria = filter
' Retrieve the contacts.
Dim account As BusinessEntityCollection = service.RetrieveMultiple(query)
14. Dezember 2009 16:29
tw-electric hat geschrieben:Dim condition As New ConditionExpression()
condition.AttributeName = "accountnumber"
condition.Operator = ConditionOperator.Like
condition.Values = New String() {"1000"}[/
Dim condition1 As ConditionExpression = New ConditionExpression
condition1.AttributeName = "lastname"
condition1.Operator = ConditionOperator.[Like]
condition1.Values = New [Object]() {"%Athlet%"}
14. Dezember 2009 17:01