0

I have the following sql stored procedure which I am trying to access the output parameter in my C# code.

ALTER PROCEDURE [dbo].[InsertCLR]
(
    @JudgmentText nvarchar(MAX),
    @JudgmentFormatted nvarchar(MAX),
    @DateAdded date,
    @JRId numeric OUTPUT
)
AS
    SET NOCOUNT OFF;
INSERT INTO [dbo].[CLR.JudgmentReport] ([JudgmentText], [JudgmentFormatted], [DateAdded]) VALUES (@JudgmentText, @JudgmentFormatted, @DateAdded);
SELECT JudgmentText, JudgmentFormatted, DateAdded FROM [CLR.JudgmentReport] WHERE (JRId = SCOPE_IDENTITY())
SET @JRId = SCOPE_IDENTITY()

The following is the C# code which I am using trying to get the output parameter:

this.cLR_JudgmentReportTableAdapter.Insert(this.JudgmentC1Editor.Text, xmlDataIn, DateTime.Today.Date, out jrid);

It keeps telling me the output parameter variable should use the ref keyword. I need your help folks.

Star
  • 3,222
  • 5
  • 32
  • 48
Bainn
  • 37
  • 12

1 Answers1

0

I got something from here:

Getting Identity column from sql server in C#

This worked fine for me. Thanks

Bainn
  • 37
  • 12