[RESOLVED] How to save Listview items in sql table-VBForums
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
    481

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

    how to save listview items in slq table

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    88,542

    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.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.