i want to load a table of database to a listview.i know how to create columns for listview and how to add items in them,
but i don't know how to add data from database with linq.
databaseDataContext db = new databaseDataContext();
var query = db.accountinfos;
for (int i = 0; i < query.Count();i++ )
{
var field = db.accountinfos.Where(c => c.id == i+1).Single();
ListViewItem item = new ListViewItem(field.bankname.ToString());
item.SubItems.Add(field.accountnumber.ToString());
}
please help me.
thanks