Page 1 of 1

Invalid SQL generated LinqConnect for Metro

Posted: Wed 20 Nov 2013 13:46
by DavidF
Hi,

This query works:

var q = from o in dbContext.OrderDetails
let c = o.Customer
let cc = c.CustomerCat
select new
{
cc.Description
};

var res = q.ToList();

and generates the SQL:

SELECT t3.Description AS Description
FROM "OrderDetail" t1
INNER JOIN "Customer" t2 ON t1.CustomerId = t2.Id
INNER JOIN "CustomerCat" t3 ON t2.CustomerCatId = t3.Id

However, this query fails:

var q = from o in dbContext.OrderDetails
select new
{
o.Customer.CustomerCat.Description
};

It generates the SQL:

SELECT t3.Description AS Description
FROM "OrderDetail" t1
INNER JOIN ("Customer" t2
INNER JOIN "CustomerCat" t3 ON t2.CustomerCatId = t3.Id) ON t1.CustomerId = t2.Id

which fails with

Devart.Data.SQLite.SQLiteException
HResult=-2146233088
Message=SQLite error
no such column: t3.Description

Re: Invalid SQL generated LinqConnect for Metro

Posted: Thu 21 Nov 2013 08:29
by MariiaI
Thank you for the report on this. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.

Re: Invalid SQL generated LinqConnect for Metro

Posted: Tue 17 Dec 2013 06:47
by henn9438
The bug with silent/verysilent uninstall with the NOFEEDBACK option is fixed.

______________________
https://littlelioness.net/
click here
https://littlelioness.net/2020/10/30/office-christmas-party/

Re: Invalid SQL generated LinqConnect for Metro

Posted: Mon 10 Mar 2014 12:45
by DavidF
MariiaI wrote:Thank you for the report on this. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.
Have you made any progress on this?

Re: Invalid SQL generated LinqConnect for Metro

Posted: Tue 11 Mar 2014 13:46
by MariiaI
This is a bug in the CSharpSQLite engine, which cannot execute the SQL generated by LinqConnect for Metro. The fix for the issue will take some time, because we will contact the developers of the CSharpSQLite engine and wait for a reply from them. We will contact you when any results are available.

As a workaround, please use JOINs explicitly, e.g.:

Code: Select all

 var q = from o in db.OrderDetails
                     join od in db.Orders on o.OrderID equals od.OrderID
                     join c in db.Customers on od.CustomerID equals c.CustomerID
                    select new
                    {
                        c.Address
                    };
Or as you have written in your first post:

Code: Select all

var q = from o in dbContext.OrderDetails
          let c = o.Customer
          let cc = c.CustomerCat
          select new
          {
                    cc.Description
          };