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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:58:49+00:00 2026-06-17T21:58:49+00:00

I have a transaction with multiple inserts. All of the inserts work fine, except

  • 0

I have a transaction with multiple inserts. All of the inserts work fine, except one.
I verified the parameters, the spelling, all of it, and it seems I’m not figuring it out.
It gives me the error:

Timeout expired. The timeout period elapsed prior to completion of the operation 
or the server is not responding.

My transaction looks like this:

SqlConnection db = new SqlConnection(connString);
DataSet dataSet = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
using (db)
{
    db.Open();
    SqlTransaction trans = db.BeginTransaction();
    try
    {
        //insert into COMMSignalDefinition !!Problem HERE
        da.InsertCommand = 
            new SqlCommand("INSERT INTO COMMSignalDefinition(Name) " 
                           + "VALUES (@name)", db, trans);

        da.InsertCommand.Parameters.Add("@name", SqlDbType.NVarChar);
        foreach (DataRow row in ds.Tables["COMMTerminalSignal"].Select())
        {
            da.InsertCommand.Parameters[0].Value = row.ItemArray[1];
            da.InsertCommand.ExecuteNonQuery();
        }

        // insert into COMMSignalExceptionDefinition -- names
        da.InsertCommand = 
            new SqlCommand("INSERT INTO COMMSignalExceptionDefinition(Name) " 
                           + "VALUES (@name)", db, trans);
        da.InsertCommand.Parameters.Add("@name", SqlDbType.NVarChar);
        foreach (DataRow row in ds.Tables["COMMSignalExceptionDef"].Select())
        {
            da.InsertCommand.Parameters[0].Value = row.ItemArray[1];
            da.InsertCommand.ExecuteNonQuery();
        }

        trans.Commit();
        MessageBox.Show("You have successfully imported your Settings. " 
                        + "You can now exit the program.", 
                         "Success",
                         MessageBoxButtons.OK, 
                         MessageBoxIcon.Information);
    }
    catch (Exception e)
    {
        trans.Rollback();
        MessageBox.Show(e.Message,
                        "Error", 
                        MessageBoxButtons.OK, 
                        MessageBoxIcon.Error);
    }
}

I have more inserts which work fine (I deleted the rest of them) and I moved the one with problems at the beginning.
My question is what could I possibly do wrong?
I even verified if the “problematic” query is sent to the server, with SQL Server Profiler, and it does! And if I execute it in SQL Server Management studio, it works too.

Connection Timeout is set to 30

Can You please give me some leads ? SQL Server version is 2005 !
Thank You!

  • 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-06-17T21:58:50+00:00Added an answer on June 17, 2026 at 9:58 pm

    After hours of digging, it came out I did some tests in Management Studio, where I tested some transactions without committing them at all. So it was waiting for a commit, and I kept making, or trying to make inserts … !

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

Sidebar

Related Questions

I have a datatable that contains rows of transaction data for multiple users. Each
I have the following transaction: SQL inserts a 1 new record into a table
I have a process that starts a transaction, inserts a record into Table1, and
I have a transaction that contains multiple SQL Statements (INSERT, UPDATE and/or DELETES). When
I have a web app that is used on multiple continents. The underlying transaction
I have a java app that runs on multiple computers and they all connect
I have a certain scenario where inserts and updates are done on multiple tables
I have a piece of code that involves multiple inserts but need to execute
I have a Django app and I am trying to perform transactions over multiple
I have a transaction button on my asp.net page. If the user clicks on

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.