473,387 Members | 1,530 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,387 software developers and data experts.

Timeout Expired

Hi,

I'm connecting to a SQL server (7.0) from Excel and VBA.

I've checked the VBA and don't think I've got this wrong but I keep
getting a Timeout Expired error message. Is there a setting in SQL
that I am not aware of that I need to set? Could it be the connection
string I use?
The connection string is

Sub SQLConnection()

Dim strConnection As String
Dim Catalogue As String

Dim sSQL As String
Set SQLConn = New ADODB.Connection ' Connection Object

strConnection = "Provider='SQLOLEDB';Data Source='TEST\TEST';Initial
Catalog=composites;User ID=sa;pwd=mypassword"
SQLConn.ConnectionString = strConnection
SQLConn.ConnectionTimeout = 0 ' wait indefinately?
SQLConn.Open
End Sub
The point at which I get the time out is when I run a large update
query

SQLConn.Execute CreateSQL(i + 1)

CreateSQL is a function that updates a table with a million or so
records and about 30 inner joins (takes approx 40 seconds to execute
through Query Analyser).
Any Help much appreciated!

ct

Mar 30 '06 #1
3 7469
If you set your connection timeout to zero, I don't think that means to
wait indefinitely. Plus, that just sets how long to wait before you
make a connection to your database. What you want to set is the
CommandTimeout. The default wait is 30 seconds if you don't set it.
The CommandTimeout will say how long to wait for your update to
complete.

HTH,
Jennifer

Mar 30 '06 #2
I believe you want to set the connection CommandTimeout property to zero.
That specifies the max time a query can run when you invoke the connection
Execute method.

Separately, it's a bad practice to use 'sa' for routine application access.
Use a minimally privileged account.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"cheesey_toastie" <bl************@yahoo.co.uk> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
Hi,

I'm connecting to a SQL server (7.0) from Excel and VBA.

I've checked the VBA and don't think I've got this wrong but I keep
getting a Timeout Expired error message. Is there a setting in SQL
that I am not aware of that I need to set? Could it be the connection
string I use?
The connection string is

Sub SQLConnection()

Dim strConnection As String
Dim Catalogue As String

Dim sSQL As String
Set SQLConn = New ADODB.Connection ' Connection Object

strConnection = "Provider='SQLOLEDB';Data Source='TEST\TEST';Initial
Catalog=composites;User ID=sa;pwd=mypassword"
SQLConn.ConnectionString = strConnection
SQLConn.ConnectionTimeout = 0 ' wait indefinately?
SQLConn.Open
End Sub
The point at which I get the time out is when I run a large update
query

SQLConn.Execute CreateSQL(i + 1)

CreateSQL is a function that updates a table with a million or so
records and about 30 inner joins (takes approx 40 seconds to execute
through Query Analyser).
Any Help much appreciated!

ct

Mar 31 '06 #3
Wonderful.
I stared at that for ages.... !!

Many thanks!

Mar 31 '06 #4

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

Similar topics

0
by: Silvia | last post by:
I have a application web and when execute this for a long time generated this error: Server Error in '/RAIMServer' Application. -----------------------------------------------------------...
5
by: Jason | last post by:
Hi all I get the following error when executing a rather intense stored procedure from an ASPX page. I have tried: - Increasing timeouts on IIS 5.0 (all areas that even mention timeout) - use...
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
4
by: Nick | last post by:
Hi I am a little stuck. I have a web app which uses cookieless session management. I would like to inform a user when their session has ended but cannot work out how to implement. I thought...
3
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
4
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying...
0
by: bonita | last post by:
If I add the code for user to download the file (e.g. if(File.Exists(FILE_NAME)){......}), the ASP.NET will give the following timeout error: Timeout expired. The timeout period elapsed prior to...
1
by: Ron | last post by:
Hi, I had a stored procedure on SQL 2000 server to run calculation with large amount of data. When I called this stored procedure via System.Data.SqlClient.SqlCommand on production, i got error...
3
by: rn5a | last post by:
I am working on Win2K Pro (SP4) with P4 2.80GHz, 256MB RAM & 20GB hard disk (IIS5.0). I use Visual Web Developer 2005 Express Edition to create & edit ASP.NET apps. Whenever I log in to my m/c....
1
by: Scorpion657 | last post by:
Hey I really need help. I have a Website coded using ASP.NET and VB and for some reason, i'm getting the following error when I try to upload or access a large file which is stored in the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.