none
VB SQL query timeout RRS feed

  • General discussion

  • Hi

    I'm running the code below- for which i get a timeout error- I know I'm supposed to alter the command timout property e.g objConnection.CommandTimeout = 0- but where do i put it?

    Any help appreciated

    Thks

    Public con As ADODB.Connection
    
    Sub check()
    Function GetCon() As ADODB.Connection
        If con Is Nothing Then
            Set con = New ADODB.Connection
            con.Open "provider=SQLOLEDB;Data Source=SQLDB;Initial Catalog=DBName;Integrated Security=SSPI;"
        End If
        Set GetCon = con
        
    End Function
    
    
    Sub Update_Routine()
    Dim con As Connection
    Dim rst As Recordset
    Set con = New Connection
    
    Set rst = GetCon.Execute("exec mysqlprocedure")
    
    End Sub
    

    David

    Wednesday, April 29, 2015 8:04 PM

All replies

  • Hi David,

    Try this:

    Set con = New ADODB.Connection

    Con.commandtimeout = 0

    Con.open "...


    Brian, ProcessIT- Hawke's Bay, New Zealand

    Thursday, July 9, 2015 9:26 PM