Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0
This is the forum to discuss the Wrox book Professional ADO.NET 3.5 with LINQ and the Entity Framework by Roger Jennings; ISBN: 9780470182611
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 8th, 2009, 03:39 AM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question Creating Dynamic Where Clause In LINQ

I have a problem to create dynamic Where clause in LINQ Query.

I am try to use the following code in which i am filtering the multiple record of the same columns.
Code:
 List<string> FilterList = new List<string>();
 FilterList.Add("ABC"); 
 FilterList.Add("ABD");
 FilterList.Add("ABE");
 var REFD = from dcodes in Program.LookupData.G_CODES.AsEnumerable()
                       where FilterList.Contains(dcodes.CODE_VALUE)
                           select new
                           {
                               CODE = dcodes.Field<string>("CODE_VALUE"),
                               DESC = dcodes.Field<string>("DESCR")
                           };
The above code filter a record just as like operator.
I am also trying to other way given below.
Code:
var REFD = from dcodes in Program.LookupData.G_CODES
                       .where("CODE_VALUE = 44 AND DESC = 'ddd' ")
                       .Orderby("CODE_VALUE")
                           select new
                           {
                               CODE = dcodes.Field<string>("CODE_VALUE"),
                               DESC = dcodes.Field<string>("DESCR")
                           };
IF there is any other best way to dynamically build the Query Please let me know about. thanks for early message.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating dynamic textboxes djricochet ASP.NET 2.0 Professional 0 March 14th, 2006 11:04 AM
Stored Procedure - Dynamic Where Clause Terry_Pino BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 2nd, 2004 04:39 PM
Creating Dynamic Images mvollmer Classic ASP Basics 0 March 4th, 2004 12:31 PM
creating dynamic list fyeojo VS.NET 2002/2003 4 September 2nd, 2003 03:13 AM



All times are GMT -4. The time now is 01:36 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.