Loading

Help to delete record using listview

1 post / 0 new
Offline
Joined: 11/11/2009
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

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.