Skip to Content
0
Former Member
Jul 18, 2016 at 02:14 PM

Entity Framework LINQ expression causes Error 2123

40 Views

It seems to me ADS is not very suitable to Entity Framework. Does anyone really use it?

The reason for my assumption is, that a function like this is not working:

private static void DoTest2(string surName)

{

...

var customers = from c in entities.Customers

where c.Surname==surName // <--- FAILS! But: c.Surname=="BlaBla" is okay

select c;

...

}

At runtime this exception is thrown:

Error 7200: AQE Error: State = S0000; NativeError = 2123; [iAnywhere Solutions][Advantage SQL Engine]Data type of parameter cannot be determined AdsCommand query execution failed.

The reason for this exception is the generated SQL:

WHERE (("Extent1"."Surname" = :p__linq__1) OR (("Extent1"."Surname" IS NULL) AND (:p__linq__1 IS NULL)))

Precisely the expression "(:p__linq__1 IS NULL)" causes the error. It is generated since string is a reference type and can be null.

I really hope I missed something and you help me out of this frustation. I have a little demo to reproduce the error. Unfortunately it is not possible to attach a zip file with 8MB? Please let me now, how can I send it to you?

I use Visual Studion 2015, Entity Framework Version 6.1.3, Advantage.Data.Provider Version 11.10.0.30 and Advantage Database Server 11.10.0.24.