Asked By HaraldBaci
09-Jan-09 04:24 PM

Hallo alle zusammen!!!
Ich habe den folgenden Code hier schon mal gepostet, aber in einem etwas
anderem Zusammenhang. Folgendes:
Ich habe ein (für mich) ziemlich komplexes SQL Statement & versuche daraus
eine LinQ zu machen (was für mich noch sehr kryptisch wirkt...) Das
SQL-Statement lautet:
SELECT
iprolenstype.bezeichnung,
iprolenstype.standard_marke,
iprolenstype.`ein_mehrstärken`,
iprolenstype.phototrop,
iprolenstype.manufacturer_code,
iprolenstype.material,
iprolensrange.hst_code_grundglas as hst_code_grundglas
FROM
iprolensrange iprolensrange INNER JOIN
iprolenstype iprolenstype ON
iprolensrange.hst_code_grundglas = iprolenstype.hst_code_grundglas
WHERE
(:HSRe*iprolensrange.cyl_shs_von/100+:HSRe BETWEEN
iprolensrange.shs_von/100 and iprolensrange.shs_bis/100) AND
(:HSRe*iprolensrange.cyl_shs_bis/100+:HSRe BETWEEN
iprolensrange.shs_von/100 and iprolensrange.shs_bis/100) AND
(:cylRe BETWEEN iprolensrange.cyl_von/100 and iprolensrange.cyl_bis/100) AND
(:HSLi*iprolensrange.cyl_shs_von/100+:HSLi BETWEEN
iprolensrange.shs_von/100 and iprolensrange.shs_bis/100) AND
(:HSLi*iprolensrange.cyl_shs_bis/100+:HSLi BETWEEN
iprolensrange.shs_von/100 and iprolensrange.shs_bis/100) AND
(:cylLi BETWEEN iprolensrange.cyl_von/100 and iprolensrange.cyl_bis/100) AND
(CURDATE() Between IfNull(iprolenstype.lieferbar_ab, CurDate()) And
IfNull(iprolenstype.lieferbar_bis, CurDate()))
GROUP BY
iprolenstype.`ein_mehrstärken`,
iprolensrange.hst_code_grundglas
ORDER BY
iprolenstype.standard_marke,
iprolensrange.hst_code_grundglas,
iprolenstype.`ein_mehrstärken`
------------------------------------------
Den oberen Bereich glaube ich inzwischen gelöst zu haben:
Dim LensType = From Range In
VisualOPTNet.GetProvider.DtsGesamt.iprolensrange _
Join Type In
VisualOPTNet.GetProvider.DtsGesamt.iprolenstype On _
Range.Field(Of String)("hst_code_grundglas") Equals _
Type.Field(Of String)("hst_code_grundglas") Where _
((HSRe * Range.Field(Of Integer?)("cyl_shs_von") /
100 + HSRe) >= _
(Range.Field(Of Integer?)("shs_von") / 100) And _
(HSRe * Range.Field(Of Integer?)("cyl_shs_von") /
100 + HSRe) <= _
(Range.Field(Of Integer?)("shs_bis") / 100) AndAlso _
(cylRe >= Range.Field(Of Integer?)("cyl_von") / 100)
And _
(cylRe <= Range.Field(Of Integer?)("cyl_bis") /
100)) AndAlso _
((HSLi * Range.Field(Of Integer?)("cyl_shs_von") /
100 + HSLi) >= _
(Range.Field(Of Integer?)("shs_von") / 100) And _
(HSLi * Range.Field(Of Integer?)("cyl_shs_von") /
100 + HSLi) <= _
(Range.Field(Of Integer?)("shs_bis") / 100) AndAlso _
(cylLi >= Range.Field(Of Integer?)("cyl_von") / 100)
And _
(cylLi <= Range.Field(Of Integer?)("cyl_bis") /
100)) And _
Now >= Type.Field(Of Date?)("lieferbar_ab") And _
Now <= Type.Field(Of Date?)("lieferbar_bis") _
------------------------------
Doch mein großes Problem & Mysterium sind die zwei letzten Sachen: Group By
& Order by. - Kann mir da bitte jemand sagen, wie das geht.... & falls noch
jemand nicht schlafen kann, könnte er einen Blick auf den anderen Code noch
werfen....
DANKE euch jetzt schon mal allen!!!!
PS: - LinQ to DataSet!!!!!!!!!!!!!!!!!!!!!!!!!!