Note that there are some explanatory texts on larger screens.

plurals
  1. POISingleResult does not contain a definition for 'Single' and no extension method 'Single'
    primarykey
    data
    text
    <p>i am getting a weird error. my sproc looks like this </p> <pre><code>CREATE PROCEDURE [dbo].[SaveFaq] ( @Id int , @Question nvarchar(MAX) , @Answer nvarchar(MAX) , @Status nvarchar(50) , @ModifiedBy nvarchar(50) ) AS SET NOCOUNT ON ; Declare @newId as INT if not exists(select * from [Faq] where [Id] = @Id) begin INSERT into [Faq] ( [Question], [Answer], [Status], [ModifiedBy], [CreatedDate] , [CreatedBy] , [ModifiedDate] ) VALUES ( @Question, @Answer, @Status, @ModifiedBy, GETDATE() , @ModifiedBy , GETDATE() ) select @newId = SCOPE_IDENTITY() end else begin UPDATE [Faq] SET [Question] = @Question, [Answer] = @Answer, [Status] = @Status, [ModifiedBy] = @ModifiedBy, [ModifiedDate] = GETDATE() Where Id = @Id select @newId = @Id end Select * from [Faq] where Id = @newId </code></pre> <p>notice the last like will select the newly inserted record</p> <pre><code>public static int Save(int id, string question, string answer, WorkflowStatus status, string modifiedBy) { using (var dc = ProjectLogic.GetDataContext()) { return dc.SaveFaq(id, question, answer, status.ToString(), modifiedBy).Single().Id; } } </code></pre> <p>i get an error like this..</p> <pre><code>'System.Data.Linq.ISingleResult&lt;Web.Data.DataContext.SaveFaqResult&gt;' does not contain a definition for 'Single' and no extension method 'Single' accepting a first argument of type 'System.Data.Linq.ISingleResult&lt;Web.Data.DataContext.SaveFaqResult&gt;' could be found (are you missing a using directive or an assembly reference?) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload