I have a SQL statement to delete a record from a database table. After stepping through it, I can see that it all works correctly, except for the final part (that is to say, it correctly gets the desired row to delete and all variables match the values that they should be). I'm new to using SQL, so can anybody tell me how to fix the following error at all?
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: Incorrect syntax near '*'.
SQL query:
Public Shared Sub deleteRecord(ByVal recordID As Integer, con As OleDbConnection)
Dim Dc As New OleDbCommand
Dc.Connection = con
con.Open()
Dc.CommandText = "DELETE * FROM tblData WHERE([recordID] = '" & recordID & "')"
Dc.ExecuteNonQuery()
con.Close()
End Sub
*. Syntax isDELETE FROM [TABLE] WHERE [FILTERS]intprevents SQL injection you are still potentially bloating the plan cache with single use queries.