I can't seem to wrap my head around this. I'll need a seasoned programmer to push in the right direction. I have a listView with 7 sub items. What I'm looking to do is populate a table in an .mdb file with the data. The listView box is almost the same as the .mdb table I'm attempting to populate. It contains a static number of rows and about 10 columns (some of the columns will be populated with static data others with the dynamic data from the listview.

cnn.Open(); //Open database connection
foreach (ListViewItem toSenditems in this.listView1.Items)
{
     //insert a new row in the table
     for (int i = 0; i < toSenditems.SubItems.Count; i++)
     {
      //Fill the row with sub items
     }
}
cnn.Close();

I can't figure out where in the loops to place my ExecuteNonQuerys and how to structure my sqlcommands.

I can't figure out where in the loops to place my ExecuteNonQuerys and how to structure my sqlcommands

My recommendation is to make subfunctions such as

(Psuedocode)

function insert(string table, string data, string whereclause)
 {
         //comands to insert structured correctly
      }

This make life a lot more simpler when you are going to be working a lot with databases.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.