CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2003
    Location
    Malaysia (P.J)
    Posts
    410

    SQL timeout issue

    I'm using SQL express and during my application startup, i do a basic query to the database.
    (e.g select column1 from table1)
    This table only has 30 records but the rest of the tables has many. Because my app runs the query to this table first, i get the error. My database size is 2.0 GB (i know it's huge)

    My timeout limit i set is 60 seconds. IS there any other solution for this rather than increasing the timeout value?

    This timeout issue only happens on and off... but not always. I'm using C# with .Net 2.0.

    Thanks
    Back after a long hibernation.

  2. #2
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: SQL timeout issue

    How much data does this query return? thousands of rows?
    Do you have right indexes on right columns if you use a where cluase?
    can you consider paging data?
    the more details you post the more hlp you can get
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

  3. #3
    Join Date
    Jun 2003
    Location
    Malaysia (P.J)
    Posts
    410

    Re: SQL timeout issue

    the table I'm quering only has 23 rows.
    Back after a long hibernation.

  4. #4
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: SQL timeout issue

    can you post your connection string ?
    I suspect that you attach the DB on connection...
    Also external factors can affect the query. is the machine with SQL serve under big load?
    you can check performance monitor to get some useful info.
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

  5. #5
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: SQL timeout issue

    Given the use of SQL Express, I am betting that this occurs when the SQLEngine has "idled down", and the long time is for a SQL restart. This can be confirmed [or eliminated] by PerfMon and the event log.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  6. #6
    Join Date
    Jun 2003
    Location
    Malaysia (P.J)
    Posts
    410

    Re: SQL timeout issue

    hspc,

    This would be my connection string :
    "Data Source=ABC;Initial Catalog=aaa;User Id=sa;Password=abc"
    Back after a long hibernation.

  7. #7
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: SQL timeout issue

    newvista..
    Connection string seems ok to me .. you should check the performance monitor and logs.
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured