I created a default ASP.Net WebForms Project in Visual Studio 2012 and trying to get my data access going before proceeding but I can't seem to return any data using ObjectDataSource. Here is what I have done.
I used EF CodeFirst to create a simple DB with two table and I can see the DB exists and I added three rows of data to it.
I created this data access class to retrieve data from that database
public class BillRepository
{
BillContext _context = new BillContext();
public List<Bill> GetBills()
{
return (from b in _context.Bills where b.UserName == HttpContext.Current.User.Identity.Name
select b ).ToList();
}
public void AddBill(Bill b)
{
b.UserName = HttpContext.Current.User.Identity.Name;
_context.Bills.Add(b);
_context.SaveChanges();
}
}
Then I create this webform to ...
Go to the complete details ...