Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   Insert listbox items into a ms sql database (https://www.askmehelpdesk.com/showthread.php?t=390958)

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

  • All times are GMT -7. The time now is 04:23 AM.