tecknoize Posted October 10, 2003 Posted October 10, 2003 hey guys, I'm trying to delete a selected record from a ListView. I did it like this: [color=blue]Dim[/color] MyConnection [Color=blue]As New[/Color] OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Application.StartupPath & "\Data.mdb") MyConnection.Open() [color=blue]Dim[/color] MyCommand [Color=blue]As New[/Color] OleDbCommand("DELETE FROM MyTable WHERE ID = '" & lvwCustomers.FocusedItem.SubItems.Item(0).Text & "'", MyConnection) [color=blue]Dim[/color] MyReader As OleDbDataReader = MyCommand.ExecuteReader() But I got a Query Syntax Error . Help Quote
*Experts* Volte Posted October 10, 2003 *Experts* Posted October 10, 2003 Try replacing that last line with:MyCommand.ExecuteNonQuery() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.