日期:2014-05-17  浏览次数:20429 次

你这样用过存储过程吗?
页面代码:

  int rowsAffected;
  SqlParameter[] parameters ={
  new SqlParameter("@ID",SqlDbType.Int,4),
  new SqlParameter("@PayMoney",SqlDbType.Money),
  new SqlParameter("@PayMemo",SqlDbType.Text),
  new SqlParameter("@PayWay",SqlDbType.VarChar,50)
  };
  parameters[1].Direction = ParameterDirection.Output;
  parameters[1].Value = strPayMoney;
  parameters[2].Value = strPayMemo;
  parameters[3].Value = strPayWay;

  DbHelperSQL.RunProcedure("spAddCustomerPayRecords", parameters,out rowsAffected);
  decimal returnValue = (decimal)parameters[1].Value;


存储过程:
CREATE PROCEDURE spAddCustomerPayRecords 
  @ID int,
  @payMoney money output,
  @payMemo text,
  @payWay varchar(50)
as
 INSERT INTO customerPayRecords(
  payMoney,payMemo,payWay
  )values(
  @payMoney,isnull(@payMemo,'111'),@payWay
  )
  set @payMoney=@@IDENTITY
GO

我想把金额返回到页面读出来,,怎么就返回不了呢?


------解决方案--------------------
看不懂最上面的语言,帮顶.
------解决方案--------------------
donet的调用
探讨
C# code

protected void Button1_Click(object sender, EventArgs e)
{

int rowsAffected;
SqlParameter[] parameters ={
new SqlParameter("@ID",SqlDbType.Int,4),
new SqlParameter("……