title: Linq to SQL using StoredProcedure - How to return a value (insert, update, delete)
body: <p>How do we return a value from a stored procedure</p>
  
  <p>here is my sp looks like:</p>
  
  <pre><code>create proc dbo.spInsertGroup
  @ID uniqueidentifier
  @GroupName varchar(100),
  @IsActive bit
  AS
  BEGIN
  
  
  
  insert into tblGroup
  values(@ID, @GroupName, @IsActive)
  
  Select @@IDENTITY AS ID
  
  END
  </code></pre>
  
  <p>based on the return value i want to show the user some kind of feedback wether the save was successfull or failed.</p>
  
  <pre><code>public void AddInquiry(Inquiry inq)
  {
     using (var transaction = new TransactionScope())
     {
        using (MyDataContext dc = conn.GetContext())
        {
           var results =  dc.spInquiry_Insert(......).ToList();
  
           transaction.Complete();
  
           var returnValue = (int)results.ReturnValue; 
           // note that ReturnValue is of type object and must be cast. 
        }
     }
  }
  </code></pre>
  
  <p>error:</p>
  
  <blockquote>
    <p>Error 39  'System.Collections.Generic.List'
    does not contain a definition for
    'ReturnValue' and no extension method
    'ReturnValue' accepting a first
    argument of type
    'System.Collections.Generic.List'
    could be found (are you missing a
    using directive or an assembly
    reference?)</p>
  </blockquote>