このストアド プロシージャを呼び出す必要がありますが、それを .dbml に取り込むと、結果が ISingleResult に変換されます。すべてのパラメーターでこれを適切に呼び出す方法がわかりません。これは私の現在のコードですが、「結果を返す」と「無効な表現用語「戻り」」というエラーが表示されます。ありがとうございました。
public static int CreateNewTransferee(CreateTransferee model)
{
using (var db = new NJB.NJBDataContext())
{
var result = db.SP_AddTransferee(
model.TransferEffectiveDate,
model.TransfereeName,
model.TransfereeNoticeAddressLine1,
model.TransfereeNoticeAddressLine2,
model.TransfereeNoticeCity,
model.TransfereeNoticeState,
model.TransfereeNoticeZip,
model.TransfereeNoticePhone,
model.TransfereePaymentAddressLine1,
model.TransfereePaymentAddressLine2,
model.TransfereePaymentCity,
model.TransfereePaymentState,
model.TransfereePaymentZip,
model.TransfereePaymentPhone,
return (int) result.ReturnValue;
}
}
更新: SP は次のとおりです。
ALTER PROCEDURE [dbo].[SP_AddTransferee]
-- Add the parameters for the stored procedure here
@TransferEffectiveDate datetime,
@TransfereeName varchar(50),
@TransfereeNoticeAddressLine1 varchar(50),
@TransfereeNoticeAddressLine2 varchar(50),
@TransfereeNoticeCity varchar(50),
@TransfereeNoticeState varchar(2),
@TransfereeNoticeZip varchar(12),
@TransfereeNoticePhone varchar(50),
@TransfereePaymentAddressLine1 varchar(50),
@TransfereePaymentAddressLine2 varchar(50),
@TransfereePaymentCity varchar(50),
@TransfereePaymentState varchar(50),
@TransfereePaymentZip varchar(50),
@TransfereePaymentPhone varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO TransfereeList
VALUES (@TransferEffectiveDate, @TransfereeName, @TransfereeNoticeAddressLine1, @TransfereeNoticeAddressLine2,
@TransfereeNoticeCity, @TransfereeNoticeState, @TransfereeNoticeZip, @TransfereeNoticePhone,
@TransfereePaymentAddressLine1, @TransfereePaymentAddressLine2,
@TransfereePaymentCity, @TransfereePaymentState, @TransfereePaymentZip, @TransfereePaymentPhone);
SELECT SCOPE_IDENTITY();
終わり