Using:
VS 2005
Llbl Gen Pro V2
SQL 2005
Brain 1972 lol!
Ok, I tried to mimic this example in the help file:
Dim invoices As New InvoicesTypedView()
Dim adapter As New DataAccessAdapter()
Dim bucket As New RelationPredicateBucket()
bucket.PredicateExpression.Add(New FieldCompareValuePredicate(InvoicesFields.OrderId, Nothing, ComparisonOperator.GreaterThan, 11000))
adapter.FetchTypedView(invoices.GetFieldsInfo(), invoices, bucket, True)
But I needed to compare against a an ID --> TaskId, plus the above predicate expression didn't seem to work for me and I ended up using a similar predicate expression pattern I found for LLBL V2:
' [VB.NET] .NET 2.0
Dim A As IPredicateExpression = New PredicateExpression()
A.Add(Table1Fields.Foo = "One")
So here is my final code:
Dim adptr As New DataAccessAdapter
Dim TaskResources As New DL.TypedViewClasses.ResourceDetailsTypedView
Dim fltrs As New RelationPredicateBucket
Dim fltr As IPredicateExpression = New PredicateExpression()
Dim TaskId As Integer
TaskId = CInt(Me.ResourceTasksList.SelectedValue)
fltr.Add(ResourceFields.TaskId = TaskId)
fltrs.PredicateExpression.Add(fltr)
adptr.FetchTypedView(TaskResources, fltrs, True)
Me.AssignedResourceList.DataSource = TaskResources
Me.AssignedResourceList.ValueMember = "Id"
Me.AssignedResourceList.DisplayMember = "ActualName"
My Error:
{"The multi-part identifier "EusProjectPortfolio.dbo.Resource.TaskId" could not be bound."}
Does anyone see my error? I can't seem to figure this one out, I take the filter out and I am good.
Here is my attempt to mirror exactly as the help file shows:
fltr.Add(New FieldCompareValuePredicate(ResourceDetailsFields.TaskId, ComparisonOperator.Equal, TaskId))
Which gives me this error:
{"Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField'."}
Thanks in advance!