我需要从我使用 MySQL 命令系统的应用程序中清空一些表内容,但它没有清空表的命令
#region Delete
public MySqlCommand Delete(string table, string column, string value)
{
_command = _command.Replace("<R>", "`" + table + "`");
_command = _command.Replace("<C>", "`" + column + "`");
_command = _command.Replace("<V>", "'" + value + "'");
return this;
}
public MySqlCommand Delete(string table, string column, long value)
{
_command = _command.Replace("<R>", "`" + table + "`");
_command = _command.Replace("<C>", "`" + column + "`");
_command = _command.Replace("<V>", value.ToString());
return this;
}
public MySqlCommand Delete(string table, string column, ulong value)
{
_command = _command.Replace("<R>", "`" + table + "`");
_command = _command.Replace("<C>", "`" + column + "`");
_command = _command.Replace("<V>", value.ToString());
return this;
}
public MySqlCommand Delete(string table, string column, bool value)
{
_command = _command.Replace("<R>", "`" + table + "`");
_command = _command.Replace("<C>", "`" + column + "`");
_command = _command.Replace("<V>", (value ? "1" : "0"));
return this;
}
#endregion
谁知道清空 table ,谢谢
最佳答案
如果您打算为每个要处理的 mySQL 命令使用该类,则必须添加另一种类型,ClearAll 或类似的类型:
_command = new StringBuilder("DELETE FROM <R>");
然后您必须将代码添加到Execute 方法之一(当然)
关于C#清空MYSQL表内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18504618/