读书人

删除表中所有记录,要怎样最简单?解决方

发布时间: 2012-02-27 10:00:22 作者: rapoo

删除表中所有记录,要怎样最简单?
我在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();
}

读书人网 >C#

热点推荐