31. März 2010 16:56
Private Sub Search()
Dim cols As New ColumnSet()
cols.Attributes = New String() {"name", "accountid", "accountnumber"}
Dim condition As ConditionExpression = New ConditionExpression()
condition.AttributeName = "name"
condition.Operator = ConditionOperator.[Like]
condition.Values = New Object() {tbSuche.Text & "%"}
Dim condition2 As ConditionExpression = New ConditionExpression()
condition2.AttributeName = "new_parentagentid"
condition2.Operator = ConditionOperator.[Like]
condition2.Values = New Object() {vertreterId = New Guid("{" + vertreterString + "}")}
Dim filter As New FilterExpression()
filter.FilterOperator = LogicalOperator.And
filter.Conditions = New ConditionExpression() {condition, condition2}
Dim query As New QueryExpression()
query.EntityName = EntityName.account.ToString()
query.ColumnSet = cols
query.Criteria = filter
ListView.Items.Clear()
Dim account As BusinessEntityCollection = service.RetrieveMultiple(query)
Dim int As Integer = 0
For Each be As BusinessEntity In account.BusinessEntities
Dim ppl As account = CType(be, account)
ListView.Items.Add(ppl.name)
ListView.Items(int).SubItems.Add(ppl.accountnumber)
ListView.Items(int).SubItems.Add(ppl.accountid.Value.ToString)
int = int + 1
Next
int = 0
End Sub
1. April 2010 11:20
1. April 2010 11:26