Solved

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

Posted on 2014-07-19
5
239 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 63

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 63

Expert Comment

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

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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