Ask Experts Questions for FREE Help !
Ask
    Mistery1's Avatar
    Mistery1 Posts: 39, Reputation: 1
    Junior Member
     
    #1

    Aug 27, 2009, 06:44 AM
    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.

Check out some similar questions!

Add a time from a TextBox into a ListBox [ 11 Answers ]

I need to add a time from a textbox into a list box with a message after that time. I've tried many different codes all with poor results. Either I can't change the time or when I changed the time it adds every move to the listbox e.g if the time is 10:00 and I want to change it to 2:00 when I...

Listbox and textbox in vb.net [ 3 Answers ]

Hi there, I wonder if anyone can help. I have a listbox and a textbox. At runtime I already have a list of items in the listbox. When I double click on these items its needs to appear in the textbox. At the moment I have the code that, when I double click on the item in the listbox ONLY one item...

ListBox problem [ 1 Answers ]

If lstSchedule.Items.Contains((0)) = True Then objWriter.WriteLine((0)) End If If lstSchedule.Items.Contains((1)) = True Then objWriter.WriteLine((1)) -----------------------until objWriter.WriteLine((7))--------------------- is this...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.