ADODB query timeout

后端 未结 3 962
遥遥无期
遥遥无期 2020-12-30 01:34

I am trying to open a query, which is timing out. I have tried setting the timeout property, but it doesn\'t seem to want to accept it.

The query takes 34 seconds to

3条回答
  •  天涯浪人
    2020-12-30 02:11

    from http://codingjourney.blogspot.com/2008/11/ado-connection-timeout-command-or.html

    The Solution

    You must also set the commandTimeout property on the ADODB.Command or ADODB.Recordset being used. Otherwise those objects will use the default time limit of 30 seconds because they do not inherit the time limit from the associated ADODB.Connection instance.

    Example Using VBScript in ASP 3:

    set con = createObject("ADODB.Connection")
    con.open connectionString
    con.commandTimeout = 60
    set command = createObject("ADODB.Command")
    command.activeConnection = con
    command.commandType = adCmdText
    command.commandText = sql
    command.commandTimeout = 60
    command.execute
    response.write command.commandTimeout 'This is now 60 seconds.
    

提交回复
热议问题