Hi Friends , I have already explained the Join concepts in sql server.We can use the join clause to combine two sources of data based on some specific criteria. If you have two lists of data then you can combine it by using join clause concepts.You can easily use this join clause concepts in your projects also for combining two lists data.You can download whole application from below and run it on your visual studio easily.
There are some steps to implement this concepts as given below:-
Step 1 :- First open your visual studio -->File -->New -->Website -->Select ASP.NET Empty Website -->OK --> Add a New web Form (Default.aspx) --> Drag and Drop ListBox and Button controls on the page from toolbox as given below:-
There are some steps to implement this concepts as given below:-
Step 1 :- First open your visual studio -->File -->New -->Website -->Select ASP.NET Empty Website -->OK --> Add a New web Form (Default.aspx) --> Drag and Drop ListBox and Button controls on the page from toolbox as given below:-
Step 2 :- Now Write the c# codes in Default.aspx.cs page (or Submit button's click) 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) { } public class Empolyee { public int index; public string Name; public int age; public double mobile; } public class emp_salary { public int number; public string salary; } protected void Button1_Click(object sender, EventArgs e) { var empoyees = new List<Empolyee>() { new Empolyee { index=101,Name = "Ram",age =20,mobile = 90152793319 }, new Empolyee { index=102,Name = "Kiran",age =28,mobile = 92152743319 }, new Empolyee { index=103,Name = "Ramesh",age =30,mobile = 98154791339 }, new Empolyee { index=104,Name = "Mohan",age =15,mobile = 90143719339 }, new Empolyee { index=105,Name = "Sunita",age =50,mobile = 99162179339 } }; var Money = new List<emp_salary>() { new emp_salary { number= 101 , salary = "12345.000" }, new emp_salary { number= 102 , salary = "13345.000" }, new emp_salary { number= 103 , salary = "15345.000" }, new emp_salary { number= 104 , salary = "18345.000" }, new emp_salary { number= 105 , salary = "45345.000" } }; var data = from emp in empoyees join s in Money on emp.index equals s.number select new { emp.index,emp.Name,emp.age,emp.mobile, s.salary }; foreach (var m in data) { ListBox1.Items.Add(m.index.ToString() + " , " +m.Name + " , " +m.age.ToString() + " , " + m.mobile.ToString()+ " , " + m.salary); } } }Descriptions :-
- In above codes, i have created two different classes(Employee,emp_salary) .
- Use Enumeration concepts and set the value to each class members.
- After that use join clause concepts and joined two lists data after that print it in Listbox control.
Note :- To make a large application ,you have to understand the small-small concepts first.
Please share this application with you friends...
Download Whole Attached file
Download
0 comments:
Post a Comment