Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I add two parameters to an entity query?  (asp.net)

Posted on 2014-07-19
5
Medium Priority
?
242 Views
Last Modified: 2014-07-20
How would I add a second WHERE parameter to this code? It works with the one, but i need a second, for Licensed .
      
string F = "Female";
string L = "licensed ";
 var HR = OE.tbl_Dept.Where(d => d.Gender.Equals(F));

DeptGrid.DataSource = HR.ToList();
        DeptGrid.DataBind();

Open in new window

0
Comment
Question by:bmanmike39
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 40206958
try to add "And"

var HR = OE.tbl_Dept.Where(d => d.Gender.Equals(F) and your conditions come here);
0
 

Author Comment

by:bmanmike39
ID: 40206962
Doesn't work, error on the And.
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 40207361
Hi bmanmike39;

Try it like this. Make sure that I used the correct column name Licensed in the query. Also in your post you had an extra space in the declaration of the variable L at the end.

string F = "Female";
string L = "licensed";
var HR = OE.tbl_Dept.Where(d => d.Gender.Equals(F) && d.Licensed.Equals(L) );

DeptGrid.DataSource = HR.ToList();
DeptGrid.DataBind();

Open in new window

0
 

Author Closing Comment

by:bmanmike39
ID: 40207454
Thanks,  just what i was looking for.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40207456
Not a problem bmanmike39, glad to be of help.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question