RTE - column prefix does not match

Posts   
 
    
mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 14-Jun-2006 18:01:30   

All--

Please help.

All of sudden, (famous last words), I am getting a RTE error saying that the "column prefix does not match" and I cannot figure out why.

The complete error message is below.

FYI, we are using LLBLGen, ASP.NET, VS.NET 2003, VB.NET, .NET 1.1, the Adapter templates, SQL Server 2000, web services, SD.LLBLGen.Pro.DQE.SqlServer.NET11.dll Version 1.0.20051.51207, SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll Version 1.0.20051.51214, Windows XP Pro, IIS 5.1, and so on.

All that I did was add some Views to my database, add the TypedView in LLBLGen, and then Generate the code. (I think that's all I did.)

What do you think might be causing this RTE?

Please advise.

Thank you.

--Mark Kamoski

<completeErrorMessage>

SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: The column prefix 'RulesEngine.dbo.BreDatatypeCode' 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. at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFactory2 entityFactory, IEntityCollection2 collectionToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, Boolean allowDuplicates, IValidator validatorToUse, IEntityFields2 fieldsUsedForQuery) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket) at FMGlobal.Research.RulesEngine.MetaDataManager.ObjectSchema.AddElementForPropertyInfo(XmlDocument& targetXmlDocument, XmlElement& parentTypeInfo, XmlElement& childPropertyInfo, PropertyInfo childPropertyInfoData) in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\ObjectSchema.vb:line 557 at FMGlobal.Research.RulesEngine.MetaDataManager.ObjectSchema.AddElementForTypeInfo(XmlDocument& targetXmlDocument, XmlElement& parentAssemblyInfo, XmlElement& childTypeInfo, Type childTypeInfoData) in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\ObjectSchema.vb:line 468 at FMGlobal.Research.RulesEngine.MetaDataManager.ObjectSchema.InitProcess(XmlDocument& targetXmlDocument, String assemblyPath) in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\ObjectSchema.vb:line 789 at FMGlobal.Research.RulesEngine.MetaDataManager.ObjectSchema.Init(String[] assemblyPathList) in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\ObjectSchema.vb:line 678 at FMGlobal.Research.RulesEngine.MetaDataManager.ObjectSchema..ctor(String[] assemblyPathList) in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\ObjectSchema.vb:line 201 at FMGlobal.Research.RulesEngine.MetaDataManager.Controller.GetCountOfMetaDataRows() in C:\projects\Shared\RulesEngine\RulesEngine.MetaDataManager\Controller.vb:line 116 at FMGlobal.Research.RulesEngine.ServiceInterface.AdminService.GetCountOfMetaDataRows(String targetFolderPath) in C:\projects\Shared\RulesEngine\RulesEngine.ServiceInterface\AdminService.asmx.vb:line 126

</completeErrorMessage>

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 14-Jun-2006 19:11:59   

Do you have a table or view with the name 'RulesEngine.dbo.BreDatatypeCode' in your db?

Frans Bouma | Lead developer LLBLGen Pro
mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 14-Jun-2006 20:15:07   

Otis wrote:

Do you have a table or view with the name 'RulesEngine.dbo.BreDatatypeCode' in your db?

Yesiree!

It is a table.

Running this SQL...

select * from RulesEngine.dbo.BreDatatypeCode

...in QueryAnalyzer returns a pile of rows.

What do you think?

Thank you.

--Mark Kamoski

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 14-Jun-2006 21:06:45   

I think you're connecting to the wrong server with your connection string somehow.

Frans Bouma | Lead developer LLBLGen Pro
mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 14-Jun-2006 21:28:26   

Otis wrote:

I think you're connecting to the wrong server with your connection string somehow.

Nope.

It was me-- the schmuck.

:-)

Here's what happened...

I got a HelperClasses.EntityCollection object and an IEntityFactory2 object.

I built a complex PredicateExpression and a RelationPredicateBucket.

I ran it and got back a collection of ObjectTypeA.

I built a new complex PredicateExpression and a RelationPredicateBucket, based on ObjectTypeB.

But, I did NOT (unfortunately) reset the EntityCollection or the EntityFactory to be ObjectTypeB.

Well, when I ran the new PredicateExpression to fetch the collection, OOPs... cannot query ObjectTypeB with a where clause based on ObjectTypeA.

Ug.

As usual-- the error is between the seat and the keyboard.

However...

I did discover this LLBLGen hidden (for me) gem...

...I caught the exception and in the Immediate Window I typed this...


?DirectCast(ex, ORMQueryExecutionException).QueryExecuted.ToString()

...and it gave me this...


SELECT 
[RulesEngine].[dbo].[BrePropertyInfo].[Id], 
[RulesEngine].[dbo].[BrePropertyInfo].[BreDatatypeCodeId], 
[RulesEngine].[dbo].[BrePropertyInfo].[BreTypeInfoId], 
[RulesEngine].[dbo].[BrePropertyInfo].[CanRead], 
[RulesEngine].[dbo].[BrePropertyInfo].[CanWrite], 
[RulesEngine].[dbo].[BrePropertyInfo].[Name] 
FROM 
[RulesEngine].[dbo].[BrePropertyInfo]  
WHERE 
( ( [RulesEngine].[dbo].[BreDatatypeCode].[Value] = @Value))

...which explained things to my thick head...

...that is, basically-- you cannot include columns in the WHERE clause that are not part of some SELECT... Doh!!!!

Anyway, finding out about...

?DirectCast(ex, ORMQueryExecutionException).QueryExecuted.ToString()

...made the whole thing worth it.

(I'm losing my hair anyway-- who cares if I pull some of it out myself.)

(BTW, the happy-ending is that that was the only thing keeping the code from running. It looks OK in terms of output, so that is good. But, this silly coding error has me rethinking my code. Time for some Divide-And-Conquer refactoring.)

Thank you.

--Mark Kamoski