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
Richard Arnold
1.7k
13
17.1k
Populating a ListView's ListItem and SubItem from data in a SQL database
Aug 2 2009 9:09 PM
Dear Sirs:
I'm not sure if this is the right forum or not, but I have a C# WinForms application with a ListView control, containing 3-columns, i.e., "Name", "Email", and "Phone".
It also has 4-textboxes on the form, i.e., "FirstName", "LastName", "Email", and "Phone#", for which the user can enter data and save it to the database.
The application has a SQL database with a simple "AddressBook" table with an autoincremented column, i.e., "AddressID" and columns for "FirstName", "LastName", "Email", and "PhoneNumber" fields.
I also have an "AddressBookDataSet" and an "AddressesTableAdapter".
I'm not interested in anything databound, nor in using a DataGridView; but would like to know how to retrieve data from each row/column and use it to populate the ListView's ListItem and SubItem's. I'll also need to concatenate the FirstName and LastName column data for the ListView's "Name" column.
I have searched unsuccessfully for examples, both in the MSDN help file as well as Online but can't find what I need.
I can successfully Insert data into the table but need to know how to use my query "SELECT FirstName, LastName, Email, PhoneNumber FROM dbo.Addresses" to populate those ListView items.
Thank you in advance.
Reply
Answers (
2
)
C# Return Type
Exporting and Importing Forms to XML