Hello Muthu,

  I would say that your issue is at this part of the code:

  : l.RECEIPTITEMs.FirstOrDefault().DEPARTMENT

 and/or

 (l.RECEIPTDISCOUNTs.Any()

 Marco Castro


----- Original Message -----
From: Muthu Annamalai [mailto:pearlamer...@hotmail.com]
To: firebird-net-provider@lists.sourceforge.net
Sent: Wed, 8 May 2013 22:34:13 -0500
Subject: [Firebird-net-provider] LINQ Outer Error

I Use VS 2012 Ultimate, EF 5.0 Code First, Firebird Provider 3.0.2.0

When I use the following LINQ query

 

public IQueryable<SalesTotalCountZDepartmentSalesPeriod

        {

            get

            {

                return (from r in ReceiptRepository.NoTracking()

                        where r.RECEIPTDATE >= ReportEndDate &

                              r.RECEIPTDATE <= ReportEndDate

                        from l in r.RECEIPTLINEs

                        let department =

                            l.ITEMSTYLE != null

                                ? l.ITEMSTYLE.ITEM.CATEGORY.DEPARTMENT

                                : l.RECEIPTITEMs.FirstOrDefault().DEPARTMENT

                        group l by department

                            into receiptLines

                            select new SalesTotalCount

                                {

                                    Name = receiptLines.Key.DEPARTMENTNAME,

                                    Total = (double)receiptLines.Sum(l =>

                                                                      l.QUANTITY * l.PRICE -

                                                                      (l.RECEIPTDISCOUNTs.Any()

                                                                           ? l.RECEIPTDISCOUNTs.Sum(d => d.DISCOUNT)

                                                                           : 0)),

                                    Count = receiptLines.Count(),

                                    Listed = receiptLines.Key.LISTED

                                });

            }

        }

 

Firebird is throwing this exception

 

SQL error code = -104

Token unknown - line 35, column 4

OUTER ---&amp;gt; Dynamic SQL Error

SQL error code = -104

Token unknown - line 35, column 4

OUTER

   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)

   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)

   at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)</ExceptionString><InnerException><ExceptionType>FirebirdSql.Data.Common.IscException, FirebirdSql.Data.FirebirdClient, Version=3.0.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c</ExceptionType><Message>Dynamic SQL Error

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to