Plz Help!!!

Posts   
 
    
Posts: 12
Joined: 05-Apr-2006
# Posted on: 02-May-2006 11:38:39   

LLBLGen Pro 1.0.2005.1 Final

Generator Configuration : Adapter


Hi EveryOne,

I have three tables:

User - UserId Name Company Link - UserId AddressId Address - AddressId Address1 Address2 State Country

Relations: User.UserId - PrimaryKey Link.UserId - ForeignKey

Link.AddressId - PrimaryKey Address.AddressID - ForeignKey

I need to get the details in User table based on the State.

There is no direct relation between User and Address table. So i tried to add a new relation in the LLBLGen UI as User - Link - Address, and in my application wrote this code:

public static HelperClasses.EntityCollection GetData(string state) { EntityCollection results = new EntityCollection(new UserEntityFactory()); IPrefetchPath2 path = new PrefetchPath2((int)EntityType.UserEntity);

  path.Add(UserEntity.PrefetchPathLink);
  path.Add(UserEntity.PrefetchPathAddressCollectionViaLink);

  IRelationPredicateBucket bucket = new RelationPredicateBucket();

  bucket.PredicateExpression.Add(PredicateFactory.CompareValue  
  (AddressFieldIndex.State, ComparisonOperator.Equal, state));

  DataAccessAdapter adapter = new DataAccessAdapter();
  adapter.FetchEntityCollection(results, bucket, path);

  return results;

}

But I get this error with the FetchEntityCollection line:

"An exception was caught during the execution of a retrieval query: The column prefix 'Testdb.dbo.Address' does not match with a table name or alias name used in the query.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."

How to Solve this issue?

Plz help.

Thanks in Advance, Dhivya.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 02-May-2006 21:24:34   

You didn't add the relation to the RelationPredicateBucket, only the filter.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 12
Joined: 05-Apr-2006
# Posted on: 03-May-2006 15:50:38   

It worked well.

Thanks a lot Otis.

Thanks, Dhivya.