Hye dude,
Really need help. My problem is I want to insert data from treeview checkboxes into database. Currently im using an array, but when i insert the value it become double. for example, when i click two checkbox. the id insert in database will be two. Can someone help me? since i'm a newbie in vb programming.. sory for bad english.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim s As String = ""
Dim bool As Integer
con.Open()
cmd.Connection = con
For Each n As TreeNode In GetCheck(TreeView1.Nodes)
If n.Text = "Can Add" and n.Checked = True Then
s = n.Name
bool = 1
End If
If n.Text = "Can Edit" And n.Checked = True Then
s = n.Name
bool = 0
End If
cmd.CommandText = "Insert into subtreeright (FormName, CanDelete, CanEdit) " & _
" Values ('" & s.ToString & "', '" & bool.ToString & "', '" & bool.ToString & "')"
cmd.ExecuteNonQuery()
Next
MsgBox("New User Saved!")
con.Close()
End Sub