M
maxshiner
Guest
Using VS 2013 Community, 2014 SQL Express and Windows Pro 8.1.
I have the Agents Table (AgentsDataSet) as the binding source for the Controls on the form shown below. I am trying to delete the shown row using the code block below. I get an message saying an unhandled exception has occured. I found no information there.
Could someone please tell me what is missing from the code?
Thanks
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Locate the row to delete
Dim oldAgentsRow As AgentsDataSet.AgentsRow
oldAgentsRow = AgentsDataSet._Agents.FindByagentname("ComboBox1.SelectedValue")
Delete the row from AgentsDataSet
Try
oldAgentsRow.Delete()
MsgBox("Update Successful")
Catch ex As Exception
MsgBox("Delete Failed")
Delete Row from Database
Try
Me.AgentsTableAdapter.Update(Me.AgentsDataSet._Agents)
MsgBox("Update Successful")
Catch es As Exception
MsgBox("Update Failed")
End Try
End Try
End Sub
Continue reading...
I have the Agents Table (AgentsDataSet) as the binding source for the Controls on the form shown below. I am trying to delete the shown row using the code block below. I get an message saying an unhandled exception has occured. I found no information there.
Could someone please tell me what is missing from the code?
Thanks
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Locate the row to delete
Dim oldAgentsRow As AgentsDataSet.AgentsRow
oldAgentsRow = AgentsDataSet._Agents.FindByagentname("ComboBox1.SelectedValue")
Delete the row from AgentsDataSet
Try
oldAgentsRow.Delete()
MsgBox("Update Successful")
Catch ex As Exception
MsgBox("Delete Failed")
Delete Row from Database
Try
Me.AgentsTableAdapter.Update(Me.AgentsDataSet._Agents)
MsgBox("Update Successful")
Catch es As Exception
MsgBox("Update Failed")
End Try
End Try
End Sub
Continue reading...