本文介绍了SQL截断问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想删除表的所有行,因此我在项目中使用以下代码:-
Hello,
I want to delete all the rows of a table so i use the following code in my project:-
public int DeleteALL()
{
SqlCommand cmd = new SqlCommand(cn);
cmd.CommandText="Truncate Table TempMonth";
int i = -1;
try
{
i = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
this.error = ex.Message;
}
return i;
}
现在我的概率是....表中的所有行均被删除,但i的值仍为-1.这意味着ExecuteNonQuery()不返回任何内容.
now my prob is.... all the rows from the table is deleted but the value of i is still -1. That means ExecuteNonQuery() doesn''t return anything. what is the prob here anyone please give answer.
推荐答案
这篇关于SQL截断问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!