|
Linq составной Where
|
|||
---|---|---|---|
#18+
В SQL запросе можно составить условие Where в зависимости от выбранных пользователем условий выборки. Пример: ... |
|||
:
Нравится:
Не нравится:
|
|||
22.01.2015, 11:08 |
|
Linq составной Where
|
|||
---|---|---|---|
#18+
TD6370В SQL запросе можно составить условие Where в зависимости от выбранных пользователем условий выборки. Пример: ... |
|||
:
Нравится:
Не нравится:
|
|||
22.01.2015, 11:09 |
|
Linq составной Where
|
|||
---|---|---|---|
#18+
TD6370, if (CheckBox1.IsChecked == true) { WhereStr =+ "City=" & value1 } { if (CheckBox2.IsChecked == true) { WhereStr =+ " AND City=" & value2 } cnn.execute = "SELECT * FROM Tab WHERE " + WhereStr Теперь вопрос как сделать составной Where на LINQ, например if (CheckBox1.IsChecked == true) { WhereStr =+ c.City == "London" } { if (CheckBox2.IsChecked == true) { WhereStr =+ c.City == "Paris" } var SelectStan = from c in ObjStan where WhereStr select c; Чтобы получилось вроде этого: var SelectStan = from c in ObjStan where c.City == "London" || c.City == "Paris" select c; Пробовал делегаты вставлять в linq: Func<RabBD.Stan, bool> Where1 = c => c.Ms.StartsWith(ValueStan); var SelectStan = from c in ObjStan where Where1 select c; Не позволяет( ... |
|||
:
Нравится:
Не нравится:
|
|||
22.01.2015, 11:19 |
|
|
start [/forum/topic.php?fid=20&gotonew=1&tid=1401993]: |
0ms |
get settings: |
9ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
43ms |
get topic data: |
11ms |
get first new msg: |
8ms |
get forum data: |
2ms |
get page messages: |
43ms |
get tp. blocked users: |
1ms |
others: | 12ms |
total: | 151ms |
0 / 0 |