Click here to Skip to main content
15,566,262 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My question is how to Insert Multiple Selected values using checkedListbox in vb.net2008 to Sql Server2005... In which i am using CheckedlistBox1 and One comboBox ...
My code is this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SQL
For Each item As CheckedListBox In CheckedListBox1.Items
       If item.SelectedItems.ToString Then
           'Insert code for inserting data to SQL
           cmd.CommandText = "insert into Module_Control_tbl (empl_ID,Module_ID) Values('" & ComboBox1.SelectedValue & "','" & CheckedListBox1.SelectedValue & "')"
           ComboBox1.Focus()
           cmd.Connection = Cn
           cmd.ExecuteNonQuery()
           MsgBox("Assign Module Successfully to Employee")
           Form7_Load(sender, e)
       End If
   Next
Posted
Comments
Member 10853731 10-Jun-14 6:06am    
i have used this code but this one also not working properly
goathik 10-Jun-14 10:02am    
we need to know what error you are getting. Also, what does Form7_Load(sender, e) do?

1 solution

 
Share this answer
 
Comments
Member 10853731 10-Jun-14 6:07am    
I have used this code but this one not working properly givivng error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900