LinQ Statement not working

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

LinQ Statement not working

Post by Zero-G. » Thu 28 Jan 2010 16:03

Hey
I am using dotConnect for mySQL

Trying to run the following Code works fine:

Code: Select all

From Kunde In LinqProvider.GetProvider.Kundenstamms _
                                 Join Auftrag In LinqProvider.GetProvider.Auftrags _
                                 On Kunde.Kundenid Equals Auftrag.Kundenid _
                                 Join Detail In LinqProvider.GetProvider.Auftragdetails _
                                 On Auftrag.Id Equals Detail.Auftragid _
                                 Join Firmen In LinqProvider.GetProvider.Firmendatens _
                                 On Kunde.Firmenid Equals Firmen.Id _
                                 Where Detail.Icode = DirectCast(bsArtikelstamm.Current, Voptneucontext.Artikelstamm).Icode _
                                 AndAlso Auftrag.Bewegung = 0 _
                                 Select New With {.Firma = Firmen.Firmenname, .Anschrift = Firmen.Strasse, _
                                                 .Nachname = Kunde.Nname, .Vorname = Kunde.Vname, _
                                                 .Strasse = Kunde.Strasse, .PLZ = Kunde.Plz, _
                                                 .Ort = Kunde.Ort} Distinct
When I change it to this code: (Order by clause!)

Code: Select all

From Kunde In LinqProvider.GetProvider.Kundenstamms _
                                 Join Auftrag In LinqProvider.GetProvider.Auftrags _
                                 On Kunde.Kundenid Equals Auftrag.Kundenid _
                                 Join Detail In LinqProvider.GetProvider.Auftragdetails _
                                 On Auftrag.Id Equals Detail.Auftragid _
                                 Join Firmen In LinqProvider.GetProvider.Firmendatens _
                                 On Kunde.Firmenid Equals Firmen.Id _
                                 Where Detail.Icode = DirectCast(bsArtikelstamm.Current, Voptneucontext.Artikelstamm).Icode _
                                 AndAlso Auftrag.Bewegung = 0 Order By Firmen.Firmenname, Firmen.Strasse _
                                 Select New With {.Firma = Firmen.Firmenname, .Anschrift = Firmen.Strasse, _
                                                 .Nachname = Kunde.Nname, .Vorname = Kunde.Vname, _
                                                 .Strasse = Kunde.Strasse, .PLZ = Kunde.Plz, _
                                                 .Ort = Kunde.Ort} Distinct
I am getting an error called: Duplicate column name 'strasse'

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 29 Jan 2010 14:14

The problem seems to be associated with context interoperability. Are you using different contexts in the application (namely, LinqProvider.GetProvider and Voptneucontext)?
Please send me the script of the KundenStamm and Artikelstamm tables, I already have the rest of the scripts. Some test data will be appreciated.

Post Reply