Dynamic Where Clause isn't working

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Dynamic Where Clause isn't working

Post by Zero-G. » Fri 23 Mar 2012 16:07

Hey
Using Version 6.70.293 and VB.NET

I am trying to query my DataContext with an Dynamic Where Clause, where the complete Code looks like this:

Code: Select all

Dim myKunden = From Kunde In myDataContext.Kundenstamms Join _
                       Auftrag In myDataContext.Auftrags On Kunde.Kundenid Equals Auftrag.Kundenid Where _
                       Kunde.Geloescht = 0
This creates the following SQL (Which is completely correct)

Code: Select all

SELECT t1.KundenID, t1.geloescht, t1.NName, t1.VName, t1.Anrede, t1.Titel, t1.Strasse, t1.PLZ, t1.Ort, t1.VwFest, t1.NummerFest, t1.VwMobil, t1.NummerMobil, t1.EMail, t1.VersNr, t1.GebDat, t1.KrankenKassa, t1.VersGruppe, t1.Selbstbehalt, t1.KinderSB, t1.VIP, t1.Werbung, t1.Info, t1.firmenid, t1.interessenid, t1.Zeitstempel, t2.id, t2.Auftrag, t2.KundenID AS KundenID1, t2.Bewegung, t2.Auftragsart, t2.sph_re, t2.cyl_re, t2.achse_re, t2.pd_re, t2.nth_re, t2.add_re, t2.Prisma_re, t2.AchsePrisma_re, t2.Info_re, t2.visus_re, t2.dia_re, t2.bc_re, t2.exz_re, t2.zusatz_re, t2.geraetetyp_re, t2.otoplastik_re, t2.seriennummer_re, t2.batterietyp_re, t2.sph_li, t2.cyl_li, t2.achse_li, t2.pd_li, t2.nth_li, t2.add_li, t2.Prisma_li, t2.AchsePrisma_li, t2.Info_li, t2.visus_li, t2.dia_li, t2.bc_li, t2.exz_li, t2.zusatz_li, t2.geraetetyp_li, t2.otoplastik_li, t2.seriennummer_li, t2.batterietyp_li, t2.addition, t2.visusbino, t2.stereosehen, t2.binosehen, t2.hsa, t2.Verkaeufer, t2.Werkstatt, t2.refraktionist, t2.positionen, t2.krankenkassa AS krankenkassa1, t2.info AS info1, t2.aerzteid, t2.AerzteKurz, t2.AufDat, t2.BezDat, t2.RueckDatum, t2.BezBetrag, t2.bezart, t2.glasliste, t2.renummer, t2.lot_re, t2.lot_li, t2.ServiceCard, t2.Zeitstempel AS Zeitstempel1
FROM kundenstamm t1
INNER JOIN auftrag t2 ON t1.KundenID = t2.KundenID
WHERE t1.geloescht = :p0
Ok, after this, I try to add a Where Clause like this:

Code: Select all

myKunden.Where(Function(kunde) kunde.Auftrag.Aufdat >= CDate(calDatVon.Value) And kunde.Auftrag.Aufdat <= CDate(calDatBis.Value))
The code runs through without any problem, but the generated SQL doesn't change.
Please help!

THX

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Post by MariiaI » Mon 26 Mar 2012 11:41

Please specify the DBMS (and its version) you are working with. For example, we couldn't reproduce this issue when working with MySQL 5.5.
Also, I've sent you a sample project. Please check that it is not blocked by your mail filter.
Please specify what should be changed in the sample to reproduce the problem.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Post by Zero-G. » Tue 27 Mar 2012 12:16

Hey

Thanks for your help!

I have forgotten to set the code liket this:

Code: Select all

myKunden = myKunde.Where(...
Now it works!
THX

Post Reply