Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 timeout expired

Author  Topic 

tracy5436
Yak Posting Veteran

50 Posts

Posted - 2008-07-10 : 18:26:15
I have written vb code which will populate a sql table. However, the tables which the query are accessing are very big, and I keep getting a timeout expired error. I have adjusted my connectionstring to set the command timeout to 0, but this is still not working. What am I doing wrong ?

This is my connectionstring :

Dim rstupdate As New ADODB.Recordset
Dim objConn
Dim cmdString
Dim objRec
Dim startdat As Date
Dim enddate As Date
Dim procdate As String

Set objRec = CreateObject("ADODB.Recordset")
Set objConn = CreateObject("ADODB.Connection")


With cn
.ConnectionString = "Provider=MSDASQL;DSN=GREATPLAINS;User Id=sa;Password=ramses2;database=KDLTD;connect timeout=0;"
.CursorLocation = adUseClient
cmd.CommandTimeout = 0
cn.ConnectionTimeout = 0
.Open
End With
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText



Set cmd.ActiveConnection = cn

tracy5436
Yak Posting Veteran

50 Posts

Posted - 2008-07-10 : 18:28:08
I have also set the query timeout in Enterprise Manager to 0.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-10 : 23:36:33
Does tbale queried have proper index?
Go to Top of Page

tracy5436
Yak Posting Veteran

50 Posts

Posted - 2008-07-11 : 11:14:30
YES
Go to Top of Page

cvipin
Yak Posting Veteran

51 Posts

Posted - 2008-07-11 : 11:37:26
This works for me..try this out.

cn.CommandTimeout = 900000
cmd.CommandTimeout = 900000
Go to Top of Page

tracy5436
Yak Posting Veteran

50 Posts

Posted - 2008-07-11 : 17:14:28
thanks, it works.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-11 : 17:23:35
quote:
Originally posted by tracy5436

I have also set the query timeout in Enterprise Manager to 0.



This affects Enterprise Manager only. It has no effect on the client application.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -