Click here to Skip to main content
15,913,773 members
Home / Discussions / C#
   

C#

 
AnswerRe: Application version help please... Pin
mustang865-Aug-09 19:13
mustang865-Aug-09 19:13 
GeneralRe: Application version help please... Pin
JollyMansArt5-Aug-09 19:25
JollyMansArt5-Aug-09 19:25 
GeneralRe: Application version help please... Pin
mustang865-Aug-09 21:24
mustang865-Aug-09 21:24 
QuestionChange default Form in WPF Program. Pin
Joshua Henderson5-Aug-09 16:02
Joshua Henderson5-Aug-09 16:02 
AnswerRe: Change default Form in WPF Program. Pin
Super Lloyd5-Aug-09 17:43
Super Lloyd5-Aug-09 17:43 
AnswerRe: Change default Form in WPF Program. Pin
Super Lloyd5-Aug-09 17:44
Super Lloyd5-Aug-09 17:44 
GeneralRe: Change default Form in WPF Program. Pin
Joshua Henderson5-Aug-09 22:58
Joshua Henderson5-Aug-09 22:58 
QuestionHow to populate a ListView's ListItem and SubItem from data in a SQL database Pin
Richard A. Arnold5-Aug-09 15:55
Richard A. Arnold5-Aug-09 15:55 
Dear Sirs:
I have searched numerous articles online and in the built-in help file but can't find an answer to this anywhere. Confused | :confused:

I have a C# WinForms application with a ListView control named "lstVwAddress", containing 4-columns, i.e., "FirstName", "LastName", "Email", and "Phone".

My form also has 4-textboxes with the same names, i.e., "txtFirstName", "txtLastName", "txtEmail", and "txtPhone", for which the user can enter data and save it to the database.

My application has a SQL 2008 Express database with a simple "AddressBook" table with an autoincremented column, i.e., "AddressID" and columns for "FirstName", "LastName", "Email", and "PhoneNumber" fields.

It also has an "AddressBookDataSet" and an "AddressesTableAdapter".

What I would like to know is how can I loop thru and retrieve data from each row/column in the database and use it to populate the ListView's ListItem and SubItem's. I don't need to retrieve the autoincremented ID column, just the remaining ones.
I'm also not using any type of data-bound controls.

I can successfully Insert data into the table but need to know how to retrieve and populate the ListView's ListItems and subitems. Also, can I use the existing TableAdapter, or do I have to declare separate data objects to retrieve this. My TableAdapter's query is "SELECT FirstName, LastName, Email, PhoneNumber FROM dbo.Addresses"

I have tried researching this on the Internet but can't find any good examples. The examples listed were either for a data-bound control like the DataGrid or were for VB.Net and not for C#. The examples found in the built-in help file all showed manually populating the items at design time instead of pulling the data from a SQL database. Please help.

Thank you in advance.
AnswerRe: How to populate a ListView's ListItem and SubItem from data in a SQL database Pin
Christian Graus5-Aug-09 16:00
protectorChristian Graus5-Aug-09 16:00 
QuestionRe: How to populate a ListView's ListItem and SubItem from data in a SQL database Pin
Richard A. Arnold6-Aug-09 5:38
Richard A. Arnold6-Aug-09 5:38 
AnswerRe: How to populate a ListView's ListItem and SubItem from data in a SQL database Pin
Richard A. Arnold6-Aug-09 6:57
Richard A. Arnold6-Aug-09 6:57 
GeneralRe: How to populate a ListView's ListItem and SubItem from data in a SQL database Pin
Richard A. Arnold6-Aug-09 7:37
Richard A. Arnold6-Aug-09 7:37 
QuestionDatabase Data Entry problem Pin
jestgr5-Aug-09 12:41
jestgr5-Aug-09 12:41 
AnswerRe: Database Data Entry problem Pin
Christian Graus5-Aug-09 13:21
protectorChristian Graus5-Aug-09 13:21 
QuestionHELp needed Pin
unlucky_dreamer5-Aug-09 11:58
unlucky_dreamer5-Aug-09 11:58 
AnswerRe: HELp needed Pin
Luc Pattyn5-Aug-09 12:23
sitebuilderLuc Pattyn5-Aug-09 12:23 
GeneralRe: HELp needed Pin
unlucky_dreamer5-Aug-09 12:26
unlucky_dreamer5-Aug-09 12:26 
AnswerRe: HELp needed Pin
Christian Graus5-Aug-09 12:24
protectorChristian Graus5-Aug-09 12:24 
GeneralRe: HELp needed Pin
unlucky_dreamer5-Aug-09 12:29
unlucky_dreamer5-Aug-09 12:29 
GeneralRe: HELp needed Pin
Christian Graus5-Aug-09 13:20
protectorChristian Graus5-Aug-09 13:20 
GeneralRe: HELp needed Pin
unlucky_dreamer6-Aug-09 11:31
unlucky_dreamer6-Aug-09 11:31 
QuestionAssigning a SQL query result to a variable Pin
JohnQuar15-Aug-09 11:44
JohnQuar15-Aug-09 11:44 
AnswerRe: Assigning a SQL query result to a variable Pin
Christian Graus5-Aug-09 12:25
protectorChristian Graus5-Aug-09 12:25 
GeneralRe: Assigning a SQL query result to a variable Pin
JohnQuar15-Aug-09 15:16
JohnQuar15-Aug-09 15:16 
AnswerRe: Assigning a SQL query result to a variable Pin
PIEBALDconsult5-Aug-09 17:08
mvePIEBALDconsult5-Aug-09 17:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.