Insert listbox items into a ms sql database
Hi everyone,
I hope someone can help me.
I have a listbox of many items and a table with many columns to accommodate these items from the listbox. I have basically have for every item in the listbox has its own column in the database.
I need to know when someone closes the application completley, whatever items in this listbox should be inserted into the database, into their respective columns.
This is part of my code that is my main focus , the rest of the code is the connection to the database
For Each item In ListBox2.Items
myCommand.CommandText = "Insert Into Programs (Printer1,Printer2 ) values ('" & ListBox2.Text & "','" & ListBox2.Text & " ')"
myCommand.ExecuteNonQuery()
Next
Anyhelp would be really appreciated.