mySQL .NET API - Delete all data from table
Posted
by
keynesiancross
on Stack Overflow
See other posts from Stack Overflow
or by keynesiancross
Published on 2011-01-14T16:48:30Z
Indexed on
2011/01/14
16:53 UTC
Read the original article
Hit count: 109
Hi all, I'm trying to figure out if there is an easy way to delete all the data in a table using the mySQL .NET API. The only slightly more tricky part to this is that in the C# code, the business logic can be run in both cases where there is, or isn't, data in teh table. So in some regards I almost need an If statement...
Currently I am using the following code, but it doesn't seem to ever delete data...
string deleteSQL = "DELETE FROM `data`.`currentData`";
MySqlCommand cmd2 = new MySqlCommand(deleteSQL, conn);
Any thoughts would be much appreciated! Cheers
© Stack Overflow or respective owner