I have treeview with checkboxes on it and need to update the database(if unchecked) and insert into the database(if checked) in my button click sub routine. I'm using a hashtable to avoid having 'duplicate keys' in run time. I'm obviously doing something very wrong because the code jumps straight from the 'For each' statement to the 'End Sub' line.
Code:
Private Sub cmdUpdate_Click(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles cmdUpdate.Click
Dim sUpdate as String = ""
Dim node as TreeNode
For each node in tvQuestions.Nodes
If node.checked Then
If node.text = htxref.item(tvQuestions.SelectedNode) Then
sUpdate = "Update............" 'actual SQL statement too long for here
Else
sUpdate = "Insert......" 'actual SQL statement too long for here
End if
End if
Next
'SQL execution statements here'
End Sub
Comment