Data Mining in asp.net

By
"Binding  the data with control is called Data Mining".
There are two types of Data Mining which are given below.
1. ) Simple Data Mining 
2.) Complex Data Mining
1. ) Simple Data Mining:-
In this only one value is bound with the control and for this we can use Label  and Text Box controls.
2. ) Complex Data Mining:- In this more than one values can be bounded with the the controls and for this we can use DropdownList ,Bulleted list ,List box, Grid view ,repeater ,Database , FormsViewes,Details Views etc.
Example of simple Data mining:-
In simple Data mining we can bind the control with not only Database table data but properties and Functions also.
There are some steps to implement simple Data mining which are given below.
Step 1:-First open your visual studio -->File -->New-->website-->ASP.NET Empty Website-->OK-->Open solution Explorer-->Add New Web Form -->Drag and drop Label controls as shown below:-

web form

Step 2:-Double click on the web form(press F7) and write the following codes:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class simplemining : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        str = "hello student";
        str2 = "hello employee";
        Page.DataBind();
        Label1.DataBind();
        Label2.DataBind();
    }
    public String str
    {
        get;
        set;
    }
    public String str2
    {
        get;
        set;
    }
    public string show()
    {
        String s = "hello friends how are you";
        return s;
    }
}


Step 3:- Now click on Source button from below and bind the all label controls with property and function as shown below:-
binding

Step 4:-Now Run the application (press F5).
OUTPUT:-
output


Description :- Here i have created  properties (str,str2) and function(show()).First two label is bind with the properties variable str and str2. third label is bind with show() function.

Note:- Data binding expression is <%#variable%>

Create temporary table is SQL Server :- 
If we want to used table ,procedure and function for the short time till the time SQL Server window open instead of creating permanent object.We can create two types of temporary object in SQL Server.
1.) Local temporary object
2.) Global temporary object

1.) Local temporary object:-
Local object is created by the single '#' sign  as the prefix of object name and this object is accessible only that window that it is created.
Example:- 



2.) Global temporary object:-
It will have ## sign as the prefix of object name  and it will accessible any window where it is created as well as other window of the SQL Server.
Example:-


Example of complex data mining:-

  1. How to perform some operations in Gridview control
  2. How to perform some operations in Repeater control
  3. How to perform some operations in Data List control

There are some steps to implement the complex data mining which are given below:-
Step 1:-First open your visual studio -->File -->New-->website-->ASP.NET Empty Website-->OK-->Open solution Explorer-->Add New Web Form -->Drag and drop Label and Dropdownlist controls as shown below:-
complex mining


Step 2:- Now double click on Button click and write the following codes,which are given below:-

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class complexmining : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection con = new SqlConnection("data source=DIAMOND-PC;Integrated Security=Yes;Database=master");
            con.Open();
            SqlCommand cmd = new SqlCommand("select*from ##employee",con);
            SqlDataReader dr = cmd.ExecuteReader();
            DropDownList1.DataSource = dr;
            DropDownList1.DataTextField = "eid";
            DropDownList1.DataValueField = "ename";
            DropDownList1.DataBind();
        }
        else
        {
            Label1.Text = "hello friends";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = DropDownList1.SelectedItem.Text;
        Label2.Text = DropDownList1.SelectedValue;
    }
}


Step 3:-Now Run the application (press F5)-->select dropdownlist value and click Submit button as shown below:-
complex_output


For More -
  1. Validation control in asp.net
  2. Multithreading 
  3. create captcha image
  4. cookies is asp.net
  5. Navigation control in asp.net
  6. Session in asp.net
For whole Application 
        Download

0 comments:

Post a Comment

Powered by Blogger.