473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Time out errors

Rob
VB.net 2005 Windows app... makes calls to 2005 SQL server... sometimes I get
a Timeout error, other times I do not...

What is the best way to handle timeout errors ?
1. How to increase the timeout - from the app it appears that the property
is "read -only" ? So must it be set at the server from within SQL
Management studio ? If so how ?

2. How would you implement a "try again" method ?

Thanks !
Jul 29 '07 #1
6 1598

"Rob" <ro***@yahoo.comwrote in message
news:Mq******************************@comcast.com. ..
VB.net 2005 Windows app... makes calls to 2005 SQL server... sometimes I
get a Timeout error, other times I do not...

What is the best way to handle timeout errors ?
1. How to increase the timeout - from the app it appears that the property
is "read -only" ? So must it be set at the server from within SQL
Management studio ? If so how ?
Maybe, you have too many connections open, because things are not being
closed properly. The application cannot get another connection and is timing
out, because of existing open connections that were never disposed.

>
2. How would you implement a "try again" method ?
Maybe, you don't want to try again and find out what the problem is, because
it shouldn't be happening.

Jul 29 '07 #2
Rob

Hi,

The code goes something like this.... I am opening, closing, disposing,
then opening, closing, disposing, again.... maybe as many as 10 times in a
row back to back.... could this be a problem ?

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd as New SqlCommand
cmd = cnn.CreateCommand
' code to execute a stored proc
cmd.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd.Dispose()
cmd=nothing

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd2 as New SqlCommand
cmd2 = cnn.CreateCommand
' code to execute a stored proc
cmd2.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd2.Dispose()
cmd2=nothing

Thanks !


"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:O3**************@TK2MSFTNGP04.phx.gbl...
>
"Rob" <ro***@yahoo.comwrote in message
news:Mq******************************@comcast.com. ..
>VB.net 2005 Windows app... makes calls to 2005 SQL server... sometimes I
get a Timeout error, other times I do not...

What is the best way to handle timeout errors ?
1. How to increase the timeout - from the app it appears that the
property is "read -only" ? So must it be set at the server from within
SQL Management studio ? If so how ?

Maybe, you have too many connections open, because things are not being
closed properly. The application cannot get another connection and is
timing out, because of existing open connections that were never disposed.

>>
2. How would you implement a "try again" method ?

Maybe, you don't want to try again and find out what the problem is,
because it shouldn't be happening.

Jul 29 '07 #3

"Rob" <ro***@yahoo.comwrote in message
news:4t******************************@comcast.com. ..
>
Hi,

The code goes something like this.... I am opening, closing, disposing,
then opening, closing, disposing, again.... maybe as many as 10 times in a
row back to back.... could this be a problem ?

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd as New SqlCommand
cmd = cnn.CreateCommand
' code to execute a stored proc
cmd.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd.Dispose()
cmd=nothing

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd2 as New SqlCommand
cmd2 = cnn.CreateCommand
' code to execute a stored proc
cmd2.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd2.Dispose()
cmd2=nothing

Thanks !
I can't say that it is. What you need to do is go to SQL Server 2005 using
the Query Analyzer equivalent that can be used on SQL Server 2000 and use
the the SQL Server Stored Procedure utility (I can't think of the Store
Procedure name) that tells you the active user-id(s) that are accessing SQL
server.

If you run your program and use that SQL Server utility, and you you see the
user-id the application is using to access SQL Server more than one time,
then you have a problem. The user-id should be showing only once throughout
the running of said application.
If this is in-line code back to back as you say, then you open the
connection one time, you execute your SQL commands, close the connection and
dispose of the connection. One connection that stays open until you execute
all the commands and then close the connection.

You use the open and close method when in-line back to back code is not
being used, with SQL Server access being done in different areas of the
code, like in different subroutines being called, as an example with their
own code to access SQl Server.
..

Jul 30 '07 #4
if you use vs.NET 2005 you would better use a using construct
Using cnn As New SqlConnection

Using cmd As New SqlCommand

End Using

End Using
"Rob" wrote:
>
Hi,

The code goes something like this.... I am opening, closing, disposing,
then opening, closing, disposing, again.... maybe as many as 10 times in a
row back to back.... could this be a problem ?

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd as New SqlCommand
cmd = cnn.CreateCommand
' code to execute a stored proc
cmd.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd.Dispose()
cmd=nothing

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd2 as New SqlCommand
cmd2 = cnn.CreateCommand
' code to execute a stored proc
cmd2.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd2.Dispose()
cmd2=nothing

Thanks !


"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:O3**************@TK2MSFTNGP04.phx.gbl...

"Rob" <ro***@yahoo.comwrote in message
news:Mq******************************@comcast.com. ..
VB.net 2005 Windows app... makes calls to 2005 SQL server... sometimes I
get a Timeout error, other times I do not...

What is the best way to handle timeout errors ?
1. How to increase the timeout - from the app it appears that the
property is "read -only" ? So must it be set at the server from within
SQL Management studio ? If so how ?
Maybe, you have too many connections open, because things are not being
closed properly. The application cannot get another connection and is
timing out, because of existing open connections that were never disposed.

>
2. How would you implement a "try again" method ?
Maybe, you don't want to try again and find out what the problem is,
because it shouldn't be happening.


Jul 30 '07 #5
Rob
Using the Activity monitor in SQL 2005, it looks like it is creating more
than one connection per user... it appears that the Dispose may not actually
killing the process id... any idea why ?

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:eR**************@TK2MSFTNGP04.phx.gbl...
>
"Rob" <ro***@yahoo.comwrote in message
news:4t******************************@comcast.com. ..
>>
Hi,

The code goes something like this.... I am opening, closing, disposing,
then opening, closing, disposing, again.... maybe as many as 10 times in
a row back to back.... could this be a problem ?

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd as New SqlCommand
cmd = cnn.CreateCommand
' code to execute a stored proc
cmd.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd.Dispose()
cmd=nothing

cnn = New SqlConnection(strConnection)
cnn.Open

Dim cmd2 as New SqlCommand
cmd2 = cnn.CreateCommand
' code to execute a stored proc
cmd2.ExecuteNonQuery()

cnn.close()
cnn.Dispose()

cmd2.Dispose()
cmd2=nothing

Thanks !

I can't say that it is. What you need to do is go to SQL Server 2005 using
the Query Analyzer equivalent that can be used on SQL Server 2000 and use
the the SQL Server Stored Procedure utility (I can't think of the Store
Procedure name) that tells you the active user-id(s) that are accessing
SQL server.

If you run your program and use that SQL Server utility, and you you see
the user-id the application is using to access SQL Server more than one
time, then you have a problem. The user-id should be showing only once
throughout the running of said application.
If this is in-line code back to back as you say, then you open the
connection one time, you execute your SQL commands, close the connection
and dispose of the connection. One connection that stays open until you
execute all the commands and then close the connection.

You use the open and close method when in-line back to back code is not
being used, with SQL Server access being done in different areas of the
code, like in different subroutines being called, as an example with their
own code to access SQl Server.
.

Jul 30 '07 #6

"Rob" <ro***@yahoo.comwrote in message
news:Ho******************************@comcast.com. ..
Using the Activity monitor in SQL 2005, it looks like it is creating more
than one connection per user... it appears that the Dispose may not
actually killing the process id... any idea why ?

No I don't know why. Maybe you just need to use the ADO.NET USING statement
instead.

http://www.pluralsight.com/blogs/fri...4/28/7834.aspx

Like I said, if all this is back to back SQL access with in-line code
statements in one procedure, then you only need one connection statement
and one cnn.Open for all of it. And you close it when done or use the USING
statement.
Jul 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: cody | last post by:
We have a huge project, the solutuion spans 50 projects growing. Everytime I want to start the project I have to wait nearly over 1 minute for the compiler to complete building. This is...
27
by: Mike MacSween | last post by:
Some of my users are getting 'Disk or Network Errors'. I've raised it with the network admins, they're looking into it. In the meantime... My 'standard' error handlers logs errors to a table...
7
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance....
0
by: Tiraman | last post by:
Hi , i m getting the following errors under the eventlog while i m trying to run some class that i wrote. at the first i got an error about the just-in-time : access denied and i added the...
2
by: Brett | last post by:
If you paste the URL used in this code into a browser, it will render without errors. Running the code puts it in the Catch with a Time out error but not always. I have ran both (see link below...
11
by: CMM | last post by:
I am so disappointed in VS2005. The "little things" wrong with it are just mind-boggling. Boy, I'll be so mad if I have to wait a year for the ".1" release that fixes all the bugs in this obvious...
8
by: sara | last post by:
Hi - I have looked at all posts and tried both Allen Browne's Report Sorting at run Time ( Select Case Forms!frmChooseSort!grpSort Case 1 'Name Me.GroupLevel(0).ControlSource = "LastName"...
4
by: daivdh | last post by:
I recently tried to download and install a Gadget called "Piano" which would put a piano keyboard on the screen. It downloaded and installed okay. When I dragged the keyboard from the sidebar onto...
13
by: Analizer1 | last post by:
Hello all I have a idea...and dont know if it is possible...... we have a pretty huge system at work and we send EDI Special formatted Data to Several Other Companies, via sFtp,dial up, vpn...
22
by: Tomás Ó hÉilidhe | last post by:
I've been developing a C89 microcontroller application for a while now and I've been testing its compilation using gcc. I've gotten zero errors and zero warnings with gcc, but now that I've moved...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.