Invalid SQL generated LinqConnect for Metro

Invalid SQL generated LinqConnect for Metro

Postby DavidF » Wed 20 Nov 2013 13:46

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
DavidF
 
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Re: Invalid SQL generated LinqConnect for Metro

Postby MariiaI » Thu 21 Nov 2013 08:29

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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Invalid SQL generated LinqConnect for Metro

Postby henn9438 » Tue 17 Dec 2013 06:47

The bug with silent/verysilent uninstall with the NOFEEDBACK option is fixed.

______________________
Our free braindumps typography tutorials can help you learn to create stunning web graphics. We've added some basic 640-911 dumps tutorials in our wikipedia course so you will learn useful practices to improve your website design. for more details click here Youtube you can find us on Facebook
Last edited by henn9438 on Sat 26 Jul 2014 05:55, edited 2 times in total.
henn9438
 
Posts: 1
Joined: Tue 17 Dec 2013 06:38

Re: Invalid SQL generated LinqConnect for Metro

Postby DavidF » Mon 10 Mar 2014 12:45

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?
DavidF
 
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Re: Invalid SQL generated LinqConnect for Metro

Postby MariiaI » Tue 11 Mar 2014 13:46

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
          };
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)