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 6127341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:29:44+00:00 2026-05-23T16:29:44+00:00

I am calling a webservice asynchronously , sending multiple requests and waiting for a

  • 0

I am calling a webservice asynchronously, sending multiple requests and waiting for a response from the platform.

I have identified the issue I have but cannot see the logical error which is causing it, I am very new to async calls so please excuse my poor coding!

The issue is that the result set I am getting back contains the same 50 records for each batch that is created. I am confused!

Any help is greatly appreciated and vote ups will be handed out, this is urgent!

The code I have written is below:

    public DataTable Delete(DataTable Data, string ObjectType)
    {
        rowCount = Data.Rows.Count;
        List<string[]> Batches = new List<string[]>();
        int time = 0;

        Batches = BatchBuilder(Data);

        results.Columns.Add("ID");
        results.Columns.Add("Success");
        results.Columns.Add("Errors");

        foreach (string[] batch in Batches)
        {
            string guid = Guid.NewGuid().ToString();
            guids.Add(guid);
            service.deleteCompleted += new deleteCompletedEventHandler(service_deleteCompleted);
            service.deleteAsync("Account", batch, guid);
        }

        while (processedCount != Batches.Count)
        {
            if (time == int.MaxValue - 1)
            {
                time = 0;
            }
            time++;
        }

        return results;
    }

    void service_deleteCompleted(object sender, deleteCompletedEventArgs e)
    {
        foreach (DeleteResult deleteResult in e.Result)
        {
            object[] resultRow = new object[3];
            if (deleteResult.id != null)
                resultRow[0] = deleteResult.id;

            resultRow[1] = deleteResult.success;

            if (deleteResult.errors != null)
                resultRow[2] = deleteResult.errors[0].Message;

            results.Rows.Add(resultRow);
        }
        processedCount++;
    }

    public List<string[]> BatchBuilder(DataTable table)
    {
        List<string[]> Batches = new List<string[]>();

        while (!batchingDone)
        {
            string[] IDs = new string[50];
            int arrayCrawler = 0;

            for (int v = 0; v < 50; v++)
            {
                IDs[arrayCrawler] = table.Rows[tableCrawler].ItemArray[0].ToString();

                arrayCrawler++;
                tableCrawler++;

                if (tableCrawler == table.Rows.Count)
                {
                    batchingDone = true;
                    break;
                }
                if (arrayCrawler == 50)
                {
                    arrayCrawler = 0;
                    break;
                }
            }

            Batches.Add(IDs);
        }

        return Batches;
    }
  • 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-23T16:29:44+00:00Added an answer on May 23, 2026 at 4:29 pm

    I suspect your problem comes from your service global variable that is reused for each call. Instanciate a new service instance each time.

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

Sidebar

Related Questions

Can anyone help? I have an issue with calling a asp.net webservice from jquery..
I am calling a webservice as follows.I have to display name, description and url
I have C# Client application calling Windows webservice written in WCF calling Sql Procedure
The following is my webservice calling 2 methods from dataclass (registerCustomer and getCountries): <!--
I'm calling off asynchronously to a web service (Amazon Web Services) from a Silverlight
Possible Duplicate: Calling a webservice that uses ISO-8859-1 encoding from WCF I am trying
I am calling a WebService and get a string returned from a WebMethod. The
I am currently calling a webservice from an ASP.net page. I am trying to
How can I calling a webservice not written by me from asp.net ajax. What's
I have a problem while calling a webservice. I have a .NET web service

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.