Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. SQL DB error: timeout problem

SQL DB error: timeout problem

Scheduled Pinned Locked Moved C#
databasehelpcsharpquestionlounge
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    labdakos
    wrote on last edited by
    #1

    Hello experts! I am puzzled with this problem in using c# to communicate with an SQL database. Whenever I run the application for the first time, I always receive an exception error saying that the timeout period has expired in trying to connect to the database. When I run the application for the second time (and all succeeding times), the application connects instantly with no problem. Why is my application unable to connect to the database when its in the first time? It would be too lengthy to post my code here so I am just expecting a general answer. I might be missing something simple here. Thanks a lot.

    K E 2 Replies Last reply
    0
    • L labdakos

      Hello experts! I am puzzled with this problem in using c# to communicate with an SQL database. Whenever I run the application for the first time, I always receive an exception error saying that the timeout period has expired in trying to connect to the database. When I run the application for the second time (and all succeeding times), the application connects instantly with no problem. Why is my application unable to connect to the database when its in the first time? It would be too lengthy to post my code here so I am just expecting a general answer. I might be missing something simple here. Thanks a lot.

      K Offline
      K Offline
      Kanniah
      wrote on last edited by
      #2

      Try to increase the querytime out value while connecting to database

      1 Reply Last reply
      0
      • L labdakos

        Hello experts! I am puzzled with this problem in using c# to communicate with an SQL database. Whenever I run the application for the first time, I always receive an exception error saying that the timeout period has expired in trying to connect to the database. When I run the application for the second time (and all succeeding times), the application connects instantly with no problem. Why is my application unable to connect to the database when its in the first time? It would be too lengthy to post my code here so I am just expecting a general answer. I might be missing something simple here. Thanks a lot.

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #3

        It takes two lines of code to open a connection to an SQL Connection Database. If you are using more you may have self identified the problem. On a more serious note, if you are using a file based SQL Server Express database or the database instance is on your local machine and has not started yet it could be that the timeout is set too low to allow the db time to start-up. Trying setting your timeout to at least 30 seconds.

        Need custom software developed? I do C# development and consulting all over the United States. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups