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

  • SEARCH
  • Home
  • 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 6346287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:59:18+00:00 2026-05-24T20:59:18+00:00

I am calling a table-valued function, of my database in SQL server 2008, from

  • 0

I am calling a table-valued function, of my database in SQL server 2008, from WCF Service and storing its results in LinkedList. On other side when I call this service and get this LinkedList, all of the nodes contains the same value. Code which I am using is as follow:

public class user
{
    public string name;
    public string email;
}

public class ChatService : IChatService
{

 public LinkedList<user> getOnlineList(string email)
    {
        LinkedList<user> online = new LinkedList<user>();
        JabsBaseDataContext db = new JabsBaseDataContext();
        IQueryable<onlineListResult> justOnline = db.onlineList(email);
        foreach (onlineListResult r in justOnline)
        {
            user os = new user()
            {
                name = r.fname + " " + r.lname,
                email = r.email
            };
            online.AddLast(os);
        }
        return online;
    }
}

chatService.getOnlineListCompleted += onlineRetrieved;
chatService.getOnlineListAsync(email);
void onlineRetrieved(object sender, getOnlineListCompletedEventArgs e)
{
   foreach(user us in e.Result)
   this.dispatcher.BeginInvoke(() => MessageBox.show(us.name+"\n"+us.email));
}
  • 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-24T20:59:19+00:00Added an answer on May 24, 2026 at 8:59 pm

    In onlineRetrieved, change the code in foreach loop to use a local var to hold user and use that. i.e. change

    foreach(user us in e.Result)
       this.dispatcher.BeginInvoke(() => MessageBox.show(us.name+"\n"+us.email));
    

    to

    foreach(user us in e.Result)
    {
     user currentUser = us;
       this.dispatcher.BeginInvoke(() => MessageBox.show(currentUser.name+"\n"+currentUser.email));
    }
    

    Refer this for why it is so- Problem with anonymouse delegate within foreach

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

Sidebar

Related Questions

Suppose I have a PL/SQL function that selects one value from a table. If
UPDATE : I discovered that I was calling the permalink from another table, with
I have a TSQL Table-Valued Function and it is complex. I want to ensure
I have a fairly complex query (that includes a table valued function to allow
After calling the server and turning the data it returns into a table. I
I am calling one function using dynamic SQL query which accepts TVP. Is there
so i'm calling a function in jquery that's looping over a table and determining
I know that I should have schema of a table before calling NewRow method
I have a RDLC report which has a table, calling a subreport N times.
Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function

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.