Solved

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

Posted on 2014-07-19
5
223 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
  • 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 62

Accepted Solution

by:
Fernando Soto earned 500 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 62

Expert Comment

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now