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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:39:20+00:00 2026-05-31T05:39:20+00:00

I have a SOAP web-service I am testing locally in my development environment. I

  • 0

I have a SOAP web-service I am testing locally in my development environment. I have a test Winforms application that consumes this web-service on localhost.

When the web-service is called it is meant to read from a table in a MSSQL 2008 DB and return a dataset (this part is working).

My Winforms application iterates through the rows of the dataset and inserts the dataset’s rows into the local DB. Basically, I am copying data from one table on one database to another database’s table (1:1) via web-service.

The problem..

..is that I am getting X thousand rows via the web-service and when I iterate through them on my Winforms application the code just stops looping at around 200-300 rows. I have stuck a breakpoint and using Visual Studio’s ‘Immediate Window’ I have verified that there are X thousand rows with data against them.

The project is an old .NET 2.0 Web site, it uses an old version of the Microsoft Enterprise Library v2.0.50727 for data-access.

Here is the problematic code on the Winforms application:

public static int PopulateLocalTable(DataSet ds, string DBInstance, string DBServer)
{
    if (ds.Tables.Count == 0)
    {
        return 0;
    }
    else if (ds.Tables[0].Rows.Count == 0)
    {
        return 0;
    }
    else
    {
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            using (var conn = new SqlConnection(string.Format("Data Source={0}; Initial Catalog={1}; Integrated Security=True;", DBInstance, DBServer)))
            {
                conn.Open();

                using (var command = new SqlCommand("dbo.myStoredProc", conn))
                {
                    command.CommandType = CommandType.StoredProcedure;

                        //Added for debugging purposes.
                    int id = Convert.ToInt32(dr["ID"]);
                    int teamid = Convert.ToInt32(dr["TeamID"]);
                    int companyid = Convert.ToInt32(dr["CompanyID"]);
                    string team_name = Convert.ToString(dr["Team_Name"]);
                    DateTime date = Convert.ToDateTime(dr["Date"]);
                    string aaa = Convert.ToString(dr["aaa"]);
                    int bbb = Convert.ToInt32(dr["bbb"]);
                    decimal ccc = Convert.ToDecimal(dr["ccc"]);
                    DateTime ddd = Convert.ToDateTime(dr["ddd"]);

                    command.Parameters.Add(new SqlParameter("@ID", id));
                    command.Parameters.Add(new SqlParameter("@TeamID", teamid));
                    command.Parameters.Add(new SqlParameter("@CompanyID", companyid));
                    command.Parameters.Add(new SqlParameter("@Team_Name", team_name));
                    command.Parameters.Add(new SqlParameter("@Date", date));
                    command.Parameters.Add(new SqlParameter("@aaa", aaa));
                    command.Parameters.Add(new SqlParameter("@bbb", bbb));
                    command.Parameters.Add(new SqlParameter("@ccc", ccc));
                    command.Parameters.Add(new SqlParameter("@ddd", ddd));

                    command.ExecuteNonQuery();
                }
            }
        }

        return ds.Tables[0].Rows.Count;
    }
}

Here is my app.config settings on the Winforms application:

 <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Service1Soap" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                        <message clientCredentialType="UserName" algorithmSuite="Default"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:11288/Service1.asmx" binding="basicHttpBinding" bindingConfiguration="Service1Soap" contract="ServiceReference1.Service1Soap" name="Service1Soap"/>
        </client>
    </system.serviceModel>

If I have tried modifying the connection/command timeout and I can not get it working. It is like the connection is timing out or the stream is being restricted. I am hoping it is just a config setting.. Thanks in advance.

  • 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-31T05:39:21+00:00Added an answer on May 31, 2026 at 5:39 am

    Your problem appears to be that you have the command creation outside the loop so you end up adding more and more parameters.

    Create a new command object inside the loop.

    You can use the using statement to ensure that connections and commands are cleaned up:

    using(var connection = new SqlConnection("..."))
    {
        connection.Open();
    
        using(var command = connection.CreateCommand())
        {
            // do stuf
        }
    }
    

    Update: I noticed now that the parameters are cleared. Try creating the command in the loop anyway 🙂

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

Sidebar

Related Questions

I have a SOAP web service that returns an XML in this format <SOAP-ENV:Envelope
I Have an internal SOAP Web service that is being called from an external
I have a complex RIA client that communicates with a WCF SOAP web service,
I have an ASP.NET web service running that accepts both HTTP POST and SOAP
I have an ASP.NET application which talks to a third-party SOAP web service. My
Can any body have idea how to consume php soap web service that have
I have a SOAP web service that is defined contract-first--the request and response xml
I have a .Net 4 project that has to consume a SOAP Web Service.
I have a soap web service with method: string startReaction(object reaction); Inside that method
We currently have a SOAP based web service that our in house applications use

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.