How to Implement PLINQ Query Concepts in ASP.NET Application

By
A Simple PLINQ Query concepts basically works on a large collection of data. If we use PLINQ Query on a small collection of data then effect of PLINQ is not visible. Suppose you have a large collection of data if you want to display a specific range of data then you will have to use this PLINQ concept in your c# coding.If you have small collection of data then there is no need to use PLINQ Query in your asp.net application. PLINQ Query basically introduced  to display the large collection of data with a range .In this Tutorial , i have displayed the all numbers with a specific range by a common differences.
There are some steps to implement this concepts on your ASP.NET Applocation as given below:-
Step 1 :- First open your visual studio -->File --> New -->Website -->Select ASP.NET Empty website -->OK -->Open your solution explorer --> Add a New Web form (Defult.aspx) -->Drag and Drop Text Box , Button and List Box control on the page from toolbox as shown belopw:-


web form

Step 2 :- Now Write the c# codes on each button's clicks on Default.aspx.cs page as given 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 p = int.Parse(TextBox1.Text);
        int q = int.Parse(TextBox2.Text);
        int r = int.Parse(TextBox3.Text);
        var rang_num = Enumerable.Range(p, q);
        var p_query = from value in rang_num.AsParallel().AsOrdered()
                      where value%r==0
                      select value;
        foreach (int n in p_query)
        {
            ListBox1.Items.Add(n.ToString());
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        ListBox1.Items.Clear();
    }
}


Step 3 :- Now Run the the Application (press F5) -->and Press submit Button -->You see the following output as shown below:-


output

Note:- You can Run this PLINQ Query concepts on your large Database table also.If any problem ask me...
Please share this post with your friends.....
Download Whole Attached file
    Download

0 comments:

Post a Comment

Powered by Blogger.