Copy and paste following code in form load event ..
private void ListOfRecord_Load(object sender, EventArgs e)
{
GetCreateCurrentAccountList();
}
public List<Cashir> GetCreateCurrentAccountList()
{
using (UserEntities ctx = new UserEntities())
{
var query = (from a in ctx.Cashirs
select a).Distinct();
List<Cashir> userList = new List<Cashir>();
query.ToList().ForEach(rec =>
{
userList.Add(new Cashir
{
User_Id = rec.User_Id,
username = rec.username,
password = rec.password
});
});
dataGridView1.DataSource = userList;
return userList;
}
}
}
}
No comments:
Post a Comment