[SOLVED] Problem with a Typed List

Posts   
 
    
Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 01-Oct-2004 15:58:11   

I have a typed list that is a join between Product - ProductDiscount - Discount. When I try to execute the FetchTypedList method I am getting a message as follows:

The column prefix 'Ownersway.dbo.Discount' does not match with a table name or alias name used in the query

The DB is Ownersway. I am not sure what is going on here.

Also, I am running the very latest version of the tool. Any ideas?

Thanks, Wade

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 01-Oct-2004 16:22:12   

How do you call FetchTypedList? Are you sure you pass on the RelationPredicateBucket you receive from GetRelationInfo()?

Frans Bouma | Lead developer LLBLGen Pro
Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 01-Oct-2004 16:25:08   

Here is the code.

        public DataTable GetAllProducts()
        {
            // Declare local variables.
            DataTable dt = new DataTable();

            try
            {
                
                // Declare a DataAccessAdapter.
                DataAccessAdapter da = new DataAccessAdapter();

                // Declare the ListProducts typed list.
                ListProductsTypedList products = new ListProductsTypedList();

                // Fetch the Data.
                da.FetchTypedList( products.GetFieldsInfo(), dt, null );

                // Close the Connection.
                da.CloseConnection();

                // Return the DataTable.
                return dt;

            }
            catch ( Exception ex )
            {
                throw new BizException( "SolutionDesigners.Biz.Shopping.GetAllProducts() Exception - " + ex.Message );
            }       
        }

Thanks, Wade

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 01-Oct-2004 16:54:07   

you don't pass on the relationbucket from GetRelationInfo(), so the relations needed to build the joins are not there. Do:


                // Declare the ListProducts typed list.
                ListProductsTypedList products = new ListProductsTypedList();

                // Fetch the Data.
                da.FetchTypedList( products.GetFieldsInfo(), dt, products.GetRelationInfo() );

Frans Bouma | Lead developer LLBLGen Pro
Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 01-Oct-2004 17:04:03   

Thanks! That did it.

Wade