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

所使用的存过过程代码如下:
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方法没有返回任何数据,这是为什么?

你可能感兴趣的:(存储过程)