Delete Table Rows From Database
I have a table that has lots of entries. I want to delete all the entries.
I tried this but it doesn't work.
Code:
Using connection As New SqlConnection(Form1.ConnectionString)
Using adapter As New SqlDataAdapter("SELECT EmployeeID, EmployeeID, Rate FROM EmployeeRate", _
connection)
Dim delete As New SqlCommand("DELETE FROM EmployeeRate", _
connection)
adapter.InsertCommand = delete
End Using
End Using
Re: Delete Table Rows From Database
There is no need for a DataAdapter, or an InsertCommand... you just need to create the Command object, and then execute it.
Re: Delete Table Rows From Database
Of course the SQL statement will delete all rows from the EmployeeRate table is that the desired effect?