Typed View

Posts   
 
    
carls
User
Posts: 4
Joined: 16-Apr-2007
# Posted on: 16-Apr-2007 05:28:30   

Hello. I am trying to fill a typed view from the database. I've got SQL Server 2005. The typed view in in llbl. I can make a typed view object but when my code tries to fill the object, I get an error saying that the primary key of the table that is part of the view could not be bound. I've signed an NDA so I can't post the code, but basically I've taken out the filter and wrote the code like this: CustomerViewTypedView customer = new CustomerViewTypedView(); customer.Fill(); When you set breakpoints and step through the code, as soon as it gets to customer.Fill(); it throws that unhandled exception from the TypedListDAO.cs file. It states "SqlException was unhandled by user code. The multi-part identifier "Customer.CustomerID could not be bound." The trace: aaa.DLL!aaa.DaoClasses.TypedListDAO.GetMultiAsDataTable(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFields fieldsToReturn = {SD.LLBLGen.Pro.ORMSupportClasses.EntityFields}, System.Data.DataTable tableToFill = {ExecutionView}, long maxNumberOfItemsToReturn = 0, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression sortClauses = null, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate selectFilter = {SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression}, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection relations = null, bool allowDuplicates = true, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection groupByClause = null, SD.LLBLGen.Pro.ORMSupportClasses.ITransaction transactionToUse = null, int pageNumber = 0, int pageSize = 0) Line 49 + 0x2d bytes C#

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Apr-2007 06:12:47   

Hi Carls, Please provide runtime library information (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=9076)

Also be sure you are pointing in your .config file to the Database you used at your LLBLGenPro file (.lgp) and that there is no changes unrefreshed. disappointed

If the problem persist, please post the complete Exception message. We also have signed a NDA, so if you like to post real code or lgp file, you can do it into the Helpdesk forum it'll remains confidential and no public. wink

Regards.

David Elizondo | LLBLGen Support Team
carls
User
Posts: 4
Joined: 16-Apr-2007
# Posted on: 16-Apr-2007 09:36:56   

I appreciate the help. The "File Version" of the runtime library is 2.0.7.319. The "Product Version" of the runtime library is 2.0.07.0319. The product version is 2.0.0.0. I am working on a Windows Vista machine with .NET2.0 installed.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Apr-2007 10:28:18   

I think the problem relies in how you use the filter. Would you make sure that everything works fine if you comment the filter?

If so would you post the filtering code, or a fake repro. Most probably you are using a field from an entity rather than using a TypedView filed to do the filtering.

carls
User
Posts: 4
Joined: 16-Apr-2007
# Posted on: 16-Apr-2007 16:03:49   

Good Day. I thought that the filter might be the problem as well. So I removed the filter, as a test, and just left the code as customers.Fill(); It still threw the exception. Could this have anything to do with how the typed view was generated in llbl?

carls
User
Posts: 4
Joined: 16-Apr-2007
# Posted on: 16-Apr-2007 19:49:17   

Well, guys. I'm not really sure what happened, but the code is working now. Even with the filter. Thanks for the advice on using the view fields in the filter and not just the table fields. That saves me from another headache, I'm sure. The theory is that the catalog was refreshed at some point and after that the .Fill() method worked. At any rate, thanks for the prompt responses. I was surprised at the quickness. Take care and I'll see you the next time something explodes. sunglasses -- Carl