日期:2014-05-18  浏览次数:20757 次

删除表中所有记录,要怎样最简单?
我在SQLDataAdapter的deleteCommand中写了   "   delete   *   from   tablename   ",   那要怎样应用它来删除所有记录呢?
或者还有什么别的更直接的方法?



------解决方案--------------------
truncate,delete,drop的异同点
http://www.chinaunix.net/jh/19/252763.html

using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand( "你的语句 ", connection);
command.Connection.Open();
command.ExecuteNonQuery();
}