The WHERE clause is a condition operator or filtering operator in Linq query.Which is used to define the restrictions on the basis of the elements returned.This operator is used for data retrieval purpose in Linq query or sql database.You can easily filter your output with the help of WHERE Clause concept.In this tutorial i will filter the some existing integer data output with the help of WHERE Clause in Linq query. You can perform this operation on database also.
There are some steps to implement this concept on asp.net web applications as given below:-
Step 1 :- First open your visual studio-->File -->New -->Website -->select ASP.NET Empty website -->OK -->Open Solution Explorer -->Add New Web Form(Default.aspx)-->Drag and Drop DropDownList and Button controls on the page from tool Box as shown below:-
Step 2 :-Now write the c# codes on Submit button clicks (Default.aspx.cs file) as given below:-There are some steps to implement this concept on asp.net web applications as given below:-
Step 1 :- First open your visual studio-->File -->New -->Website -->select ASP.NET Empty website -->OK -->Open Solution Explorer -->Add New Web Form(Default.aspx)-->Drag and Drop DropDownList and Button controls on the page from tool Box as shown below:-
using System; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { int[] num = {1,2,3,4,5,7,8,9,0,87,70,6,555, }; var value = from number in num where number >6 select number; foreach (var record in value) { DropDownList1.Items.Add(record.ToString()); } } }Step 3 :- Now Run the program (press F5) -->You will see following output as shown below:-
Note:-
- Here i have fetched those records form a num array which elements greater than 6, using 'where 'clause concepts.
- Learn small small concepts for making the large project.
Download
0 comments:
Post a Comment