Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 885381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:54:10+00:00 2026-05-15T12:54:10+00:00

if i try to write below codes : error return to me: The query

  • 0

if i try to write below codes : error return to me: The query results cannot be enumerated more than once

  public void StartTransaction()
        {
            using (var stockMovementCtx = new StockMovementCtxDataContext())
            using (var scope = new TransactionScope())
            {

                var stockMovementItems = from s in stockMovementCtx.spStockMovementForTransaction(TicketID, ItemTypeNo, ItemID, TransactionType,
                                                                                                  FromLocation, ToLocation, Qty, PersonelNo, cuser
                                                                                                  )
                                         select s;

                ReturnCode = stockMovementItems.First().ReturnCode;
               // MessageBox.Show(stockMovementItems.First().ToString());
                ReturnMsg = stockMovementItems.First().ReturnMessage;
                TransactionType = stockMovementItems.First().TransactionType;
                TicketID = stockMovementItems.First().TicketID;

alt text

Details:
alt text

Detail :

alt text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:54:11+00:00Added an answer on May 15, 2026 at 12:54 pm

    Short fix:

    var FirstChild = stockMovementItems.First();
    

    then

    ReturnCode = FirstChild.ReturnCode;
    //etc...
    

    or

    (from s in stockMovementCtx.spStockMovementForTransaction(TicketID, ItemTypeNo, ItemID, TransactionType, FromLocation, ToLocation, Qty, PersonelNo, cuser) select s).ToList();
    

    but the latter is kind of an abuse of Linq.

    Longer answer is that whatever stockMovementCtx.spStockMovementForTransaction(..) is, it only supports forward reading. Thus when you call First() you advance to the next result and cannot go back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Actually, it looks like the code will have to be… May 16, 2026 at 11:05 am
  • Editorial Team
    Editorial Team added an answer After each call to sqlite3_step() for which you receive a… May 16, 2026 at 11:05 am
  • Editorial Team
    Editorial Team added an answer Boost already has 2 possible solutions to your problem: Boost.Variant… May 16, 2026 at 11:05 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a function to create a pdf which should return bitarray. Below is
Below is the code to write to a file after downloading an image from
When I try to write UTF-8 Strings into an XML file using DOMDocument it
I have been trying to write an app that periodically parses the contents of
I am having trouble with XMLTextWriter.WriteStartElement throwing an exception: System.InvalidOperationException when trying to write
logging exception the code below allows to save the content of an exception in
I'm trying to write some arbitrary text to a custom control. My code works,
I write my debug information to a file using a separate thread. During startup,
Im attempting a Https post from a C# application. I could connect to the
I am trying to use session_set_save_handler to allow me to save sessions within a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.