Using your components: dotConnect for mySQL Version: 6.10.103
I want to create a query, where I get the customers and there offers, which contains some criteria.
Example:
Customer 'Mayer' is related to the offers, and they contain 2 offers for Mayer. In the offers, there is a field called "Auftrag" One row is filled with the values "Glasses" and the other row is filled with the values "Contactlens"
So, I want the customer and by running the query, ONLY the offers row with "Glasses". (Hope you undertand

So, I created the following Options and query:
Code: Select all
Dim Auftraege As New List(of String)
Auftraege.Add("Glasses")
Dim dlo As New Devart.Data.Linq.DataLoadOptions
dlo.AssociateWith(Of VOptNeuContext.Kundenstamm)(Function(Ku As VOptNeuContext.Kundenstamm) _
Ku.Auftrags.Where(Function(Auf) Auftraege.Contains(Auf.Auftrag1)))
myDataContext.LoadOptions = dlo
Dim Kunden = From Kunde In myDataContext.Kundenstamms Join
Auftrag In myDataContext.Auftrags On Kunde.Kundenid Equals Auftrag.Kundenid _
Where Kunde.Firmenid = LinqProvider.GetAktivCompanyID And _
Auftrag.Bewegung = 1 And _
Kunde.Geloescht = 0 _
Order By Kunde.Nname, Kunde.Vname _
Select Kunde Distinct
Code: Select all
For Each Kunde In Kunden
For Each Auftrag in Kunde.Auftrags
'Here all offers are available - not only these with "Glasses"
Next
Next
HTX