急求方法:c# 调用sybase 数据库存储过程,取不到返回值,请哈

急求方法:c# 调用sybase 数据库存储过程,取不到返回值,请高手指点哈
驱动用的 oledb,
存储代码:
create proc use_deptparentno
  @userno varchar(8),
  @deptparentno char(4) output
as
  begin
  declare @parentDeptno char(4)
  declare @deptno char(4)
declare @levelId int
  declare @count int
set @count=1
select @deptno=deptno from t_user_d where userno=@userno
select @levelId=levelid from t_dept where deptno=@deptno
while(@count<=@levelId)
begin
select @deptno=case when deptparentno is null then deptno else deptparentno end from t_dept where deptno=@deptno
print @deptno
set @count=@count+1
end
  set @deptparentno=@deptno
  select deptno into #Pageing1 from t_dept where deptno=@deptno
  select deptno from #Pageing1
  end

调用代码:
  string num = string.Empty;
  OleDbParameter[] param = new OleDbParameter[] {  
  new OleDbParameter("@userno",OleDbType.VarChar,8,userno),
  new OleDbParameter("@deptparentno",OleDbType.Char,4,ParameterDirection.ReturnValue,true,10,0,null,DataRowVersion.Default,num)
  };
  using (OleDbDataReader rd = OledbHelpDao.ExecuteReader(base.ConnStr, CommandType.StoredProcedure, "use_deptparentno", param))
  {
  if (rd.HasRows && rd.Read())
  {
  object o = rd.GetValue(0);
  }
  }
  string ID = Convert.ToString(param[1].Value);
  return num;

结果:datareader 的hasrows 为false
ID 的结果页是空字符串


------解决方案--------------------
先在SYBASE中调试,看看是SP还是C#的问题
------解决方案--------------------
sp是表示存储过程
------解决方案--------------------
专门为了你这个问题,写了一篇短文。其实还是蛮简单的。
请看我的短文:
http://hi.baidu.com/hexiong/blog/item/748dbc3e6d525cf6828b13ad.html

------解决方案--------------------
检查一下参数是否正确传递进去
------解决方案--------------------
就是检查@userno、@deptparentno 这两个参数的值
------解决方案--------------------
探讨

引用:
专门为了你这个问题,写了一篇短文。其实还是蛮简单的。
请看我的短文:
http://hi.baidu.com/hexiong/blog/item/748dbc3e6d525cf6828b13ad.html

大侠 我也使用过 aseclient 连接过 sybase 数据库,但有些会出现中文乱码的问题,在字符串连接里写明编码格式,也是中文乱码。
……

------解决方案--------------------
探讨

引用:
专门为了你这个问题,写了一篇短文。其实还是蛮简单的。
请看我的短文:
http://hi.baidu.com/hexiong/blog/item/748dbc3e6d525cf6828b13ad.html

大侠 我也使用过 aseclient 连接过 sybase 数据库,但有些会出现中文乱码的问题,在字符串连接里写明编码格式,也是中文乱码。
……

------解决方案--------------------
这样,你用一个表保存@deptparentno的值,看看结果如何,来判断是否是程序的问题
------解决方案--------------------
探讨

引用:
这样,你用一个表保存@deptparentno的值,看看结果如何,来判断是否是程序的问题

在 sybase 客户端执行存储,是@deptparentno 是有值的,放到临时表 中也是查的出来的,一放到程序里就不行了,代码都是贴出来了的

------解决方案--------------------
简单示例:
C#调用存储过程简单完整例子
CREATE PROC P_TEST @Name VARCHAR(20), @Rowcount INT OUTPUT AS
 BEGIN SELECT * FROM T_Customer WHERE NAME=@Name SET @Rowcount=@@ROWCOUNT 
END GO

  --存储过程调用如下:

  ----------------------------------------------------

  DECLARE @i INT EXEC P_TEST 'A',@i OUTPUT SELECT @i --结果