您的位置:首页 > 其它

关于存储过程使用的问题,谁帮忙解答下呀

2006-10-19 19:00 344 查看
所使用的存过过程代码如下:
ALTER PROCEDURE GetProductContent
(@ProductID int,
@ProductName char(20) output,
@Introduction char(200) output
)
AS
select @ProductName=[ProductName],@Introduction=[Introduction] from Product where [ProductID]=@ProductID
select InfoName,Infomation from ProductInfo where [ProductID]=@ProductID
RETURN
在asp.net中用如下代码可以正常访问:
connection.Open();
command.ExecuteNonQuery();
producteg.Introduction = command.Parameters["@Introduction"].Value.ToString();
producteg.ProductName = command.Parameters["@ProductName"].Value.ToString();
producteg.infolist = command.ExecuteReader(CommandBehavior.CloseConnection);
为什么写成下面这样就不行?
connection.Open();
producteg.infolist = command.ExecuteReader(CommandBehavior.CloseConnection);
connection.Open();
command.ExecuteNonQuery();
producteg.Introduction = command.Parameters["@Introduction"].Value.ToString();
producteg.ProductName = command.Parameters["@ProductName"].Value.ToString();
connection.Close();
这样会出错,查看错误信息,command.executerader方法没有返回任何数据,这是为什么?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: