Linq to SQL two combobox [modified]
-
we devlop program for big ISP company have 3 SQL table Provider Table [Combobox1] ID Name 1 prov1 2 prov2 3 Prov3 //// Location Table [Combobox2] ID Name 1 Loc1 2 Loc2 3 Loc3 //// End_User Table [Listview1] ID Name Provider_ID Location_ID 1 ab 1 2 2 bc 1 3 3 cd null 1 4 de 2 null //// Actually we add "All Provider" to provider combo also "All Lcoation" for location combo to get all even null. value for both "All Provider" & "All Location" set to 0 I can get fill listview user with specific provider like var user = from s in db.End_User where s.Provider_ID == comboprov.value... slect s foreach(....... this good if all location slected in comoboboxlocation or nonvalue select) i need to fill full four condition in this one statement for Linq to sql A- prov = 2 & Loc = 0(all) B- prov = 0(all) & loc = 1 c- prov = 1 & loc = -1(nothinselect) D- prov = -1(nothinselect) & Loc = 3 something like var user = from s in db.End_User where s.Provider_ID = {"*" @(if combopro.value == 0) || combopro.value} + {s.Location_ID = {"*" @(if comboloc.value == 0) || combopro.value} select s. foreach(....... Thank you...
modified on Tuesday, November 11, 2008 10:39 AM