Results 1 to 3 of 3

Thread: can i update database column through listbox data?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    44

    can i update database column through listbox data?

    Code:
    Dim conn As SqlCeConnection = Nothing
            Try
                conn = New SqlCeConnection("Data Source=" & userSpecifiedPath)
                conn.Open()
                Dim cmd As SqlCeCommand = conn.CreateCommand()
                Dim dAdp As SqlCeDataAdapter = New SqlCeDataAdapter()
                Dim ds As New DataSet
    
                cmd.CommandText = String.Format("UPDATE TABLE SET NUMBER = '{0}' WHERE '{1}' = '{2}'", zero, ListBox3.Items, DATE)
                dAdp.UpdateCommand = cmd
                cmd.ExecuteNonQuery()
    
            Catch ex As Exception
            Finally
                conn.Close()
            End Try
    i want to update the column(number) where listbox3.items is equal to date.

    Code:
    cmd.CommandText = String.Format("UPDATE TABLE SET NUMBER = '{0}' WHERE '{1}' = '{2}'", zero, ListBox3.Items, DATE)

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: can i update database column through listbox data?

    This obviously doesn't make any sense. You can match a selected item, or a specifically indexed item, but you cant match all the items as a collection.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    44

    Re: can i update database column through listbox data?

    can i insert the listbox items in a selected column in database ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width