存储过程
CREATE PROCEDURE [dbo].[GetSum]
@num1 INT,
@num2 INT,
@result INT OUTPUT
AS
BEGIN
select @result= @num1+ @num2
END
C#代码
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
namespace cux.button.test
{
[Description("测试调用存储过程")]
[HotUpdate]
public class CuxTestBosExecuteServicePlugIn : AbstractBillPlugIn
{
public override void BarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey.Equals("PBQO_tbButton"))
{
int result ;
List<SqlParam> paramList = new List<SqlParam>();
paramList.Add(new SqlParam("@num1", KDDbType.Int16,15));
paramList.Add(new SqlParam("@num2", KDDbType.Int16, 25));
paramList.Add(new SqlParam("@result", KDDbType.Int16,0) { Direction = ParameterDirection.Output });
List<SqlParam> sp = DBUtils.ExecuteStoreProcedure(this.Context, "GetSum", paramList);
result = int.Parse(sp[0].Value.ToString());
this.View.ShowWarnningMessage(String.Format("值={0}", result),"测试调用存储过程",Kingdee.BOS.Core.DynamicForm.MessageBoxOptions.OK,action:null);
}
}
}
}
参考:https://vip.kingdee.com/article/485386929324606464?productLineId=1&lang=zh-CN