.NET Framework - SQL -> LinQ

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!!!!!!!!!!!!!!!!!!!!!!!!!!
VisualOPTNet.GetProvider.DtsGesamt.iprolensrange
(1)
VisualOPTNet.GetProvider.DtsGesamt.iprolenstype
(1)
Range.Field
(1)
GetProvider
(1)
Type.Field
(1)
Equals
(1)
Range
(1)
Field
(1)
  HaraldBaci replied...
10-Jan-09 09:35 AM
Schönen Nachmittag.

Also, ich bin schon einen halben Schritt weiter gekommen.
Die offenen Frage, die jetzt noch bleiben sind 2:
1) Group By - Wie muss ich das anwenden?
2)  Bei Folgendem LinQ:
Now >= Type.Field(Of Date?)("lieferbar_ab") And _
Now <= Type.Field(Of Date?)("lieferbar_bis")
soll abgefragt werden, ob der Artikel noch lieferbar ist. - Soweit glaube
ich ist das klar. - Aber wenn die Artikel in der DB ein NULL stehen haben,
kommen diese Artikel auch nicht. - Also, wie kann ich da noch die NULL Felder
mit einschließen`?

DANKE im Voraus
Create New Account
help
actual data numbers changed Hello, I found in the 5.1.1 section : The Content-Type field for multipart entities requires one parameter, consisting entirely of two hyphen characters ("-", decimal value 45 not proving strong enough :( Thanks for the answer anyways :) This description is for the "content-type field" so it looks quite clear to me that this is the line that begins with
to it after it is been registered. I have tried to call the function TypeDescriptor.GetProvider(typeof(MyType)); to get at my description provider but instead it gives me a TypeDescriptionNode com / Forums / en-US / netfxbcl / thread / 0c88ff70-1b9f-4a6b-9977-cc4e70935e87) Thanks! C# Discussions TypeDescriptor.GetProvider (1) TypeDescriptionProvider (1) CustomTypeDescriptor (1) TypeDescriptionNode (1) TypeDescriptor (1) MyTypeDescriptionProvider (1) GetProvider (1) Attribute (1) Hi Edward, i've got the same problem, is there still a
imposing the requirements that: * Every field in the object is initialized at construction * Every reference type field in the object refers only to other immutable objects Today, I can write a type