if I select the specific rows and want to delete, what is the code?
I have try the code
but it delete all of my rows:(Code:delect from table;
Printable View
if I select the specific rows and want to delete, what is the code?
I have try the code
but it delete all of my rows:(Code:delect from table;
This is not a VB.NET question. SQL questions belong in the Database Development forum.
You need to use a WHERE clause to specify which records you want to delect (sic). If you want to delete a specific record by ID it would be:If you want to delete all records from before a specific date it would be:Code:DELETE FROM MyTable WHERE ID = @ID
Code:DELETE FROM MyTable WHERE [Date] < @Date
okay, next time I will post the sql question to Database Development forum:)
do the code add to the delete button?
What you posted and what I posted is SQL code, not VB code. If you want to execute SQL statements in VB then you use ADO.NET. If you want to do something when the user clicks a Button you handle its Click event. You need to create a Click event handler for your button and use ADO.NET to execute that SQL. Follow the Data Access link in my signature for some examples of using ADO.NET in VB.