TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abolfazl
NA
184
80.9k
how to load database in a listview with linq to sql?
Mar 23 2014 9:23 AM
hi
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.
i write this code:
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
Reply
Answers (
1
)
Prob in Website Publishing ?
how to set primary key after delete a record ?