Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to dynamically build where clause in Linq

user489948Jul 3 2012 — edited Jul 4 2012
Hello everyone,


Oracle DB:11gR2
Oracle Client: 11.2.0.3.0 (ODP.NET)
Oracle Developer Tools for Visual Studio
VS 2010 (C#)

In a Windows Form, we need to query the data based on the values of dropdown listboxes, which user will select.
Let's say, two combox, one is for Department and one is for Salary
Department:
-1 All
10 Department 1
20 Department 2
30 Department 3

Salary:
-1 All
1 < 20000
2 20000 to 50000
3 50000 to 100000
4 > 100000


Here is C# code to query data:
using (var myEDMctx = new HREntities())
{
var LINQrslt = from emp in myEDMctx.EMPLOYEES
select emp;

}


The default values for both combox should be All.
How to write the dynamic where clause for this LINQ?

Thanks in advance!!!
This post has been answered by Invincible on Jul 4 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2012
Added on Jul 3 2012
6 comments
832 views