Welcome to WebmasterWorld Guest from 174.129.135.89

Forum Moderators: open

Message Too Old, No Replies

I got "Timeout expired" Error on .MoveNext

Sql Server 2005, timeout on record movenext (not always, sometimes)

   
9:17 pm on Feb 15, 2008 (gmt 0)

5+ Year Member



here is the piece of code:

vShop_vSql = "select some from some table where some..." 'normal one
aConnStr = "Provider=SQLOLEDB;Data Source=#*$!;Initial Catalog=#*$!;User ID=#*$!;Password=#*$!;Connect Timeout=2"

Set vShop_oConn = CreateObject("ADODB.Connection")
vShop_oConn.Open aConnStr\
Set vShop_oRs = vShop_oConn.Execute(vShop_vSql)

Do while..

.....

vShop_oRs.Movenext
Loop

and got an Error on Movenext

Number: -2147217871
Category: Microsoft OLE DB Provider for SQL Server
Description: Timeout expired

Does anyone have solution, I already got data on oRs but timeout when movenext, so strange.

Thanks

5:21 am on Feb 16, 2008 (gmt 0)

5+ Year Member



Please, any idea welcome
5:23 pm on Feb 17, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Have you stepped through it with the debugger to see exactly which line is timing out? If you determined it was the .Movenext by doing this then was it the first time you issued a .Movenext...

Your headline says not all the time, some time... Could it be the 2 second timeout you've set in the connection string? In VB6 when connecting to SQLServer the default timeout was 30 seconds I think. Sounds like you might have set the timeout to 2 seconds, and sometimes you get results back in 2 secs, sometimes it takes longer (and timesout).

7:34 pm on Feb 17, 2008 (gmt 0)

5+ Year Member



I try change the connect timeout but no use. The sql server and my asp code in same box, so 2 second for connect is enough.

The timeout happend on the line of .MoveNext , in the do...while loop is some code for output by format them.

Just feel very strange, because most of time timeout happened in execute sql query. And for my case, the data already got and saved in RS object, so I cannot understand why timeout at Movenext if ASP code not timeout yet.

Is there any code can setup timeout for after got data in RS object?