Aug 29th, 2008, 03:43 AM
[RESOLVED] How to save Listview items in sql table
how to save listview items in slq table
Aug 29th, 2008, 06:44 AM
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.
Click Here to Expand Forum to Full Width
Survey posted by VBForums.