Create a EDM by adding a new ADO.NET Entity Data Model. Add your Database to it...
Some terms used.....
EDM - Entity Data Model (Mapping Layer)
CSDL - Conceptual Schema Definition Language (Conceptual Layer)
SSDL - Stored Schema Definition Language (Logical Layer)
Extension .edmx
Codes after creating the EDM file....
NationalBankModel.NationalBankEntities mm = new NationalBankModel.NationalBankEntities();
//var query = from n in mm.EmployeeDetails
// select n;
//var query = from n in mm.EmployeeDetails
// where mm.Logins.Any(Emp => Emp.EmpID >3)
// select new {n.EmpID, n.EmpName, n.EmpAddress, n.EmpPhNo };
var query = from n in mm.EmployeeDetails
//join oo in mm.Logins on n.EmpID equals oo.EmpID
where mm.Logins.Any(Emp => Emp.EmpID == 3)
//where n.EmpID > 2
select new { n.EmpID, n.EmpName, n.EmpAddress, n.EmpPhNo };
GridView1.DataSource = query;
GridView1.DataBind();
foreach (var emp in mm.EmployeeDetails)
{
ListItem li = new ListItem();
li.Text = emp.EmpID + " ";
if (!emp.Logins.IsLoaded)
{
emp.Logins.Load();
}
foreach (var p in emp.Logins)
{
li.Text += "Login Name: " + p.username + " ";
}
BulletedList1.Items.Add(li);
}
No comments:
Post a Comment