Help to delete record using listview

Hello I'm using previous example on how to populate record in listview using vb.net and mysql but when i try to use delete button the following error display! "Unhandled exception has occurred in your application.If you click continue,the application will ignore this error and attempt to continue.If you click quit,the appilcation will close immediately. Conversion from type 'MySqlException' to type 'Boolean' is not valid." Here is code i'm using Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim CustomerID As String For Each sItem As ListViewItem In lvList.SelectedItems CustomerID = sItem.Text Next If CustomerID "" Then 'Delete the selected record Dim strDeleted As Boolean strDeleted = ExecNonQuery("DELETE Customers.CustomerID FROM Customers WHERE CustomerID= '" & CustomerID & "'") If strDeleted = "True" Then MsgBox("Record's deleted.", MsgBoxStyle.Information) Call FillList() Else MsgBox(strDeleted) End If Else MsgBox("Please select record to delete.", MsgBoxStyle.Critical) End If End Sub

Add new comment