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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:50:23+00:00 2026-05-24T03:50:23+00:00

We have a operation in which more than 100.000 records are read from a

  • 0

We have a operation in which more than 100.000 records are read from a csv file and inserted in a database. When I am using a file with 10 records, the operation is completed successfully in less than one minute.

When I use 100.000 records, I am getting the following error “Invalid attempt to call Read when reader is closed.” after 10 minutes. Is there any Timeout that I can configure to avoid this error?

Note: The CommandTimeout is already set as zero.

DbCommand cmd = db.GetStoredProcCommand("aspInsertZipCode");
cmd.CommandTimeout = 0;
dataStringToProcess.Remove(dataStringToProcess.Length - 1, 1);

db.AddInParameter(cmd, "@DataRows", DbType.String, dataStringToProcess.ToString());
db.AddInParameter(cmd, "currDate", DbType.DateTime, DateTime.Now);
db.AddInParameter(cmd, "userID", DbType.Int32, UserID);
db.AddOutParameter(cmd, "CountOfUnchangedZipCode", DbType.String, 1000);

DbDataReader rdr = null;

try
{

    rdr = (DbDataReader)db.ExecuteReader(cmd);
    if (rdr.Read())
    {

        if (!String.IsNullOrEmpty(Utility.GetString(rdr, "NewZipCode")))
            strNewZipCode = strNewZipCode + "," + Utility.GetString(rdr, "NewZipCode");

    }
    rdr.NextResult();
    if (rdr.Read())
    {

        strRetiredZipCode = strRetiredZipCode + "," + Utility.GetString(rdr, "RetiredZipCode");

    }

    int TempUnchageZipCount = Convert.ToInt32(db.GetParameterValue(cmd, "CountOfUnchangedZipCode"));
    CountOfUnchangedZipCode = CountOfUnchangedZipCode + TempUnchageZipCount;
    dataStringToProcess = new StringBuilder();
    cntRec = 0;

}
catch
{
    if (rdr != null && (!rdr.IsClosed))
        rdr.Close();
    throw;
}
finally
{
    if (rdr != null && (!rdr.IsClosed))
        rdr.Close();
}
cmd.Dispose();
  • 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-24T03:50:24+00:00Added an answer on May 24, 2026 at 3:50 am

    It was actually MSDTC & Transaction issue. I updated the MSDTC timeout in Component Services. Also I updated timeout values in System.Transactions in machine.config of the application server.

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

Sidebar

Related Questions

I have to develop a component which will have a more than 100,000 instances
I have a web application which needs to perform a file copy operation and
I have written a stored procedure which retrieves more than 7000 rows. While executing
I have a reoccuring operation which composed of build somekind of key/value pairs. the
I have a WCF service which performs CRUD operation on my data model: Add,
I have a program which needs to invoke a process to perform an operation
I need a query which can do the following operation. I have a table
I have a page which contain six js included,when the page run about more
Can any body please let me know if more than one database connection at
I would like to write Python script, which will get i.e. 100 news/texts from

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.