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;
}
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.