ADO Timeout expired
Posted on 2006-11-14
I'm getting a ADO Time out error, when i run this query from VB using ADO but the same time takes about 13seconds to run in Query analyzer. Remember that i did set the cmd timeout to Zero. Check my code below. I don't think i'm doing anything wrong here, infact this is how i do it every time just works fine but it doesn't work for single client.
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
conn.ConnectionTimeout = 0
cmd.CommandTimeout = 0
15600 strSQL = "Select A.* From CAMS_rptJobAvailable_View A " + _
" where A.PositionsAvailable > A.PositionsFilled" + _
" and A.JobStatus <> 'Cancelled'" + _
" and exists(select top 1 CumGPA from CAMS_Placement_View B " + _
" Inner Join " + strTempTable + " as C on C.StudentUID = B.StudentUID" + _
" where B.CumGPA >= A.minimumGPA )"
15620 Set mdbQueryAuditObj = GetObjectContext.CreateInstance("CAMSGeneral.busCAMSGeneral")
15630 Result = mdbQueryAuditObj.WriteQueryAudit(strUserName, strDBName, strSvrName, strSQL, strError)
15640 Result = 0
15650 Set mdbQueryAuditObj = Nothing
15660 JobRs.ActiveConnection = conn
15670 JobRs.CursorLocation = adUseClient
15680 JobRs.CursorType = adOpenStatic
15690 JobRs.LockType = adLockOptimistic
15700 JobRs.Open strSQL
('JobRs.Open strSQL, Conn) - I used this statement as well as above statement but same result.
15710 JobRs.ActiveConnection = Nothing
15720 Set rsJobs = JobRs
I get timeout error on line 15700. Same exact query works locally and also on our server . Let me know if you guys have any idea.