I found a post by Miron regarding Error -2147012894, where he provided code for setting the CommandTimeout property. The code from his post is included in the code section below. A couple follow-up questions:
1. Should the typo in the last line 'com.Execute' be 'cmd.Execute' or 'con.Execute'?
2. Does setting the CommandTimeout property hold for as long as the connection is open or does it need to be set for each con.Execute?
I'm trying to apply the post to our application, but need a little more help. We typically open the connection upfront, without creating an ADODB command object:
Set MyConn = Server.CreateObject("ADODB
MyConn.open "Provider=SQLOLEDB;Data Source=my_server;Initial Catalog=my_database;UID=my
and then uses it repeatedly with calls like:
Set RS = MyConn.Execute(mySQLstr)
until the program exits. How would I set the CommandTimeout for the program?
set con = CreateObject( "ADODB.Connection" )
set cmd = CreateObject( "ADODB.Command" )
con.open "Provider=SQLOLEDB;Data Source=my_server;Initial Catalog=my_database;UID=my_user;PWD=my_password;"
set cmd.ActiveConnection = con
' set timeout to long enought value
cmd.CommandTimeout = 3600 '( 1 hour, seconds )
cmd.CommandText = "select ... | execute my_procedure ..."
set rs = com.Execute