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.
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.RecordsetDim objConnDim cmdStringDim objRecDim startdat As DateDim enddate As DateDim procdate As StringSet 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. |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-07-10 : 23:36:33
|
Does tbale queried have proper index? |
 |
|
tracy5436
Yak Posting Veteran
50 Posts |
Posted - 2008-07-11 : 11:14:30
|
YES |
 |
|
cvipin
Yak Posting Veteran
51 Posts |
Posted - 2008-07-11 : 11:37:26
|
This works for me..try this out.cn.CommandTimeout = 900000cmd.CommandTimeout = 900000 |
 |
|
tracy5436
Yak Posting Veteran
50 Posts |
Posted - 2008-07-11 : 17:14:28
|
thanks, it works. |
 |
|
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 KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
|
|