Results 1 to 2 of 2

Thread: [RESOLVED] How to save Listview items in sql table

  1. #1

    Thread Starter
    Hyperactive Member yousufkhan's Avatar
    Join Date
    Jan 2002
    Location
    India
    Posts
    492

    Resolved [RESOLVED] How to save Listview items in sql table

    how to save listview items in slq table

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to save Listview items in sql table

    This is a fine example of where a problem should be broken up into smaller subproblems. ListViews and databases have nothing to do with each other and they should be treated that way. You save data to a database the same way regardless of where it comes from. You get data from a ListView the same way regardless of where it's going to. You should treat this, and every other programming problem, as a series of boxes with pipes going in and pipes coming out. The way you make useful applications is to connect those pipes to provide a flow of data from task to task.

    So, to get data from a ListView you get a ListViewItem. You can do that by indexing either the SelectedItems collection or the Items collection. Once you have the item you can get its Text property. You can also index its SubItems property to get a ListViewSubItem and then get its Text property too.

    So, you can now get data from a ListView. That's a pipe coming out of a box. To save data to a database. you use ADO.NET. Follow the Data Access link in my signature for examples of doing that. That's another box with a pipe going in. You just need to connect the boxes so that the output from one becomes the input to the other.

    In future, remember: Divide and Conquer. Break your problem up into the smallest subproblems you can. Each of those will be inherently easier to solve. Solve each one and you have inherently solved the original problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width