如果存储过程最后是从表中取值则没有问题
即:
最后“select * from @tmp1”
改成“select * from t_qa”

解决方案 »

  1.   

    更正:即便是把最后的“select * from @tmp1”
    改成“select * from t_qa”,也不能返回结果集
    除非:
    注释掉存储过程中的以下三行
    insert @tmp1 select id,name,keyword,title,content,parent_id from t_qa where ID='00000009'
    while exists(select 1 from t_qa a,@tmp1 b where a.parent_id=b.id and a.ID not in (select ID from @tmp1))
      insert @tmp1 select a.id,a.name,a.keyword,a.title,a.content,a.parent_id from t_qa a,@tmp1 b where a.parent_id=b.ID and a.ID not in (select ID from @tmp1)
      

  2.   

    SqlCommand.CommandType=StoredProcedure;