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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:23:15+00:00 2026-05-23T06:23:15+00:00

I have been having trouble with timeout on SQL program , I have narrowed

  • 0

I have been having trouble with timeout on SQL program , I have narrowed it down to this function , i can pass parameters and it words , but in this instance I send a couple hundered . When it runs I get a timeout and maybe 6 or so get through into the database and then timeout occurs in about 2minutes. when run locally everything works fine and operations complete in a few seconds.!! any ideas? .

I know its getting the information it needs and gettting into the list and it can connect and send data to SQL. I have read maybe creating too many connections and the like but nothing seems to fix it. Any ideas or simple problems you have come accross?. also tried disabling debuggers etc as per

public void ConnectToSQl(String word, int count, String HashTag = " ")
{
    checkExcludeList();
    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = "Data Source = dev\\SQLEXPRESS ;" +
                            "Initial Catalog=sml;" + 
                            "User id=**** ;" + 
                            "Password =******;" + 
                            "Trusted_Connection=No";
    try {
        conn.Open();
        SqlCommand Command = new SqlCommand("INSERT INTO word_list (word , count)" +
                                            "VALUES (@word , @count)", conn);
        //add parameters for insert
        Command.Parameters.AddWithValue("@word", word);
        Command.Parameters.AddWithValue("@count", count);
        Command.ExecuteNonQuery();
    } catch (Exception e) {
        Box.Text = "SQL error" + e;
    } finally {
       conn.Close();
    }
}
  • 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-23T06:23:16+00:00Added an answer on May 23, 2026 at 6:23 am

    Try passing in your open connection. Opening a sql connection is very expensive.

    public void ConnectToSQl(SqlConnection conn, String word, int count, String HashTag = " ")
    {   
        if (conn.State != ConnectionState.Open)
            throw new SqlExecutionException("Sqlconnection is not open");
    
        checkExcludeList();
    
        SqlCommand Command = new SqlCommand(
            "INSERT INTO word_list (word , count)" +
            "VALUES (@word , @count)", conn);
    
        //add parameters for insert
        Command.Parameters.AddWithValue("@word", word);
        Command.Parameters.AddWithValue("@count", count);
    
        Command.ExecuteNonQuery();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been having trouble with Hibernate and Mysql timeout error for a week.
Hello I have been having trouble with this for a while now. I have
i have been having for SQL trouble, i am using an SQLite database and
i have been having this trouble when trying to obtain json data. lets say
I having trouble in dividing the HTML frames. I have been using the following
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
This is a really weird problem that I have been having. When I download
I have been trying to tackle this problem , but I am having difficulty
I have been having trouble finding straightforward code to render a scene to a
I have been having trouble find much documentation on o3d (not too surprisingly). Does

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.