There is combobox and few textboxes.
With the help of insert sqlcommand I can store textboxes values in the database.
But with the same insert sqlcommand I need to store one more combobox selected item too..
How to do this?

You could write a sql statement to instert each one, then place it in a loop.


    Dim conStr As String = "Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;"

    Dim con As New SqlConnection(conStr)
    Dim cmd As SqlCommand


        For i = 0 To ComboBox1.Items.Count


            Dim sqls As String = "INSERT INTO table (column) VALUES ('" & ComboBox1.Items(i).ToString & "')"
            cmd = New SqlCommand(sqls, con)


    Catch ex As Exception
    End Try

I tried by myself and got it .

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.