Wrong table is used to generate a query

Posts   
 
    
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 04-Feb-2005 15:21:09   

Hi,

I am using the follwoing code to fetch an Entitycollection


Dim _auftraege As New EntityCollection(New MyAuftragskoepfeEntityFactory)
Dim _filter As IRelationPredicateBucket = New RelationPredicateBucket
Dim _prefetchPath As IPrefetchPath2 = _
        New PrefetchPath2(CType(EntityType.AuftragskoepfeEntity, Integer))

If MitPositionen Then
    If MitDokumente Then
    _prefetchPath.Add(MyAuftragskoepfeEntity.PrefetchPathAuftragspositionen).SubPath.Add( _
        MyAuftragspositionenEntity.PrefetchPathAuftragsPosDokumente)
    End If
    If MitArtikel Then
        _prefetchPath.Add(MyAuftragskoepfeEntity.PrefetchPathAuftragspositionen).SubPath.Add( _
            MyAuftragspositionenEntity.PrefetchPathArtikelstamm)
    End If
End If
_filter.PredicateExpression.Add(PredicateFactory.CompareRange(AuftragskoepfeFieldIndex.AuftragsNr, Auftragkeys))
_auftraege = New EntityCollection(New MyAuftragsHerkunftEntityFactory)

Me.Adapter.FetchEntityCollection(_auftraege, _filter, _prefetchPath)

The query generated references a different table (The columns retrieved in the select query are from a different table than Auftragskoepfe) I regenerated the code, checked if any files are write-protected and I still get the error.

Any help would be greatly appreciated

Best regards and a nice weekend!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 04-Feb-2005 18:22:30   

You overwrite _auftraege with a different collection in the last line of your code: _auftraege = New EntityCollection(New MyAuftragsHerkunftEntityFactory)

Frans Bouma | Lead developer LLBLGen Pro
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 07-Feb-2005 08:38:28   

Dear Otis,

I guess this is the kind of Friday-afternonn message that make you which you would be breeding sheep in Australia or anything else but not answering such question.

I promise to never again write anything on a friday afternoon without being absolutely sure that I am not doing some nonsense.

Greetings and a nice week

N. Brake

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 07-Feb-2005 10:51:23   

Heh wink

Frans Bouma | Lead developer LLBLGen Pro