当前位置:编程学习 > C#/ASP.NET >>

**********************请问一个关于取数据库操作返回值的问题******************

我有一个这样的sql代码
"declare @str int;exec @res = theproc"

请问怎么获得这个@res的值啊 --------------------编程问答-------------------- 帮顶 --------------------编程问答-------------------- 谢谢 --------------------编程问答-------------------- select @res --------------------编程问答-------------------- declare 是定义一个变量
exec 是执行一个SQL存储过程
--------------------编程问答-------------------- select @res
--------------------编程问答-------------------- 除了用select还有其他办法吗?

--------------------编程问答-------------------- select @res --------------------编程问答-------------------- 我在这里不能用select

除了select还有其他办法吗? --------------------编程问答-------------------- "declare @str int;  exec @str = theproc;select @ret;"
用int returnValue = Convert.ToInt32(command.ExecuteScalar());执行sql语句,取得返回值 --------------------编程问答-------------------- 刚刚错了 "declare @str int; exec @str = theproc;select @str;" --------------------编程问答-------------------- 用存储过程返回值 --------------------编程问答-------------------- select @res
--------------------编程问答-------------------- 不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗?
不用select还有其他办法吗? --------------------编程问答-------------------- 麻烦大家看看我的问题好吗?

我这里不能用select

能否通过添加输参数或者其他办法获得这个值呢?

--------------------编程问答-------------------- 你想在程序里得到吗??

存储过程中用returnvalue参数.在程序里返回

--------------------编程问答-------------------- "declare @str int;exec @res = theproc"

我是用c++调用的

由于程序的设计.不能直接调用存储过程

只能调用象上面的sql

我想获得存储过程的返回值应该怎么做呢 --------------------编程问答-------------------- "declare @str int; exec @str = theproc;select @str;"

是正确的解法

不用select 没有办法 --------------------编程问答-------------------- cmd.Parameters["return_value"].Direction=ParameterDirection.ReturnValue; --------------------编程问答-------------------- c++??不知道.. --------------------编程问答-------------------- http://www.net0791.com/article/43077.htm --------------------编程问答-------------------- 不用select就没有其他办法了吗????
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,