卡不能看这个递归算法有什么错,怎末执行不了啊
private void del(string id) //id参数为选择删除的节点 {
int i;
string sql1,sql2;
sql1="select depid from dep where parent_id='"+id+"'"; //选择出节点id的所有子结点的depa_id
DataSet ds = SqlHelper.ExecuteDataSet(sql1);
if(ds.Tables.Count>0 && ds.Tables[0].Rows.Count>0)
{
for(i=0;i<ds.Tables[0].Rows.Count;i++)
del(ds.Tables[0].Rows[i]["depid"].ToString()); //删子结点
}
sql2="delete from dep where dep_id='"+id+"'"; //删除4
SqlHelper.ExecuteNoQueryString(sql2);//删当前结点
}