我通过linq to sql 类调用存储过程修改表里面的一条记录。编译都能通过,测试运行时,提示“对于映射的存储过程方法,“System.Void”不是有效的返回类型。”,这是什么情况啊?
存储过程:
- SQL code
ALTER PROCEDURE [dbo].[_sp_Web_ConfirmApplicationDetailClick] @mBillManageID nvarchar(50) = NULL, --集約_伝票管理ID 变量 @mConfirmTpye char(2) = NULL, --承認区分变量 @mProcessor nvarchar(50) = NULL, --処理者 @mComment nvarchar(200) = NULL --コメント AS BEGIN UPDATE SAP_連携承認状態 SET 承認区分 = @mConfirmTpye, 処理日 = getdate(), 処理者 = @mProcessor, コメント = @mComment, Record更新日 = getdate() WHERE 集約_伝票管理ID = @mBillManageID END
linq to sql 方法:
- C# code
[global::System.Data.Linq.Mapping.FunctionAttribute(Name = "dbo.[_sp_Web_ConfirmApplicationDetailClick]")] public void _sp_Web_ConfirmApplicationDetailClick( [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "NVarChar(50)")] string mBillManageID, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "Char(2)")] string mConfirmTpye, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "NVarChar(50)")] string mProcessor, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "NVarChar(200)")] string mComment) { this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), mBillManageID, mConfirmTpye, mProcessor, mComment); } public void ConfirmApplicationDetailClick(string BillManageID, string ConfirmType, string Processor, string Comment) { try { ItemsSearcher._sp_Web_ConfirmApplicationDetailClick(BillManageID, ConfirmType, Processor, Comment); } catch (System.Data.SqlClient.SqlException sqle) { throw (sqle); } catch (Exception Error) { throw (Error); } }
------解决方案--------------------
你可以修改存储过程 将影响行数作为返回值
------解决方案--------------------
返回值不对?