Hi,
You have next line of code
Cmd.ActiveConnection = cnn
If you think that it assigns opened connection to your
command then it is wrong. What it does is it takes
connection string from you opened connection and assigns
it to command object. It means that command will not have
already opened connection and will try to open new one
based on that connection string. And of cource that new
connection wil have its own timeout. ActiveConnection is
pointing to object and if you want it works properly use
SET
Set Cmd.ActiveConnection = cnn
Try to change it. It does not mean that it is a problem
but it could be.
Val
Quote:
>-----Original Message-----
>Hello Val,
>The connection is successfully built by the ADO
connection object and there
Quote:
>is NO "CONNECTION TIME OUT ERROR"
>Once the connection is made then this is assigned to the
command object
>here is the sample code:
>Dim cnn As ADODB.Connection
>Dim Cmd As ADODB.Command
>Set cnn = CreateObject("ADODB.Connection")
>cnn.Open Provider=SQLOLEDB;Data Source=ct21;Initial
Catalog=RCSDTU;User
>Id=sa;Password=;Connect Timeout=10
>Set Cmd = CreateObject("ADODB.Command") '-----------------
------>>>> This is
>Cmd, not Cod was pasted by mistake in the previous mail
>Cmd.ActiveConnection = cnn
>Cmd.CommandText = storedprocedurename
>Cmd.CommandType = adCmdStoredProc
>Cmd.CommandTimeout = 0
>'Assume there is no parameters
>Cmd.Execute '------------------------------->>>>
Generates Error: [Timeout
Quote:
>expired]Err No. -2147217871
>Err Source: Microsoft OLE DB Provider for SQL Server
>Regards,
>Naveed
>> Hi,
>> It could be not because of CommandTimeout, but because
of
>> ConnectionTimeout. I do not know how you are opening
>> connection, but if your command is not associated with
>> some particular opened connection then you can get that
>> kind of error. Check if your timeout is 15 seconds, then
>> it looks like you get Connection timeout error.
>> Val
>> >-----Original Message-----
>> >Hello!
>> >I have a distributed environment for Online Transaction
>> Processing
>> >System(OLTP).
>> >My VB components are running under MTS on a separate
>> server machine that
>> >communicate with the SQL Server 7.0 on the different
>> machine.
>> >The request from the Web clients successfully executed
by
>> MTS components
>> >that UPDATE or GET data from SQL Server 7.0
>> >On the MTS Machine a process run at End of Day, that
>> manipulates huge
>> >amount of data i.e Update records, Move records from
one
>> table to another
>> >and Delete records from the tables in the transaction
>> context.
>> >Many storedprocedures call during this process under
one
>> MTS Transaction.
>> >and these storedprocedures repeatedly call in the loop.
>> This yields a huge
>> >transaction log that I don't want to maintain that.
>> >I got the following error on the line that execute the
>> stored procedure. and
>> >this occurs randomly on different stored procedures.
>> >Error:[Timeout expired]
>> >Err No. -2147217871
>> >Err Source: Microsoft OLE DB Provider for SQL Server
>> >- ADO Command.Time out is set to 0
>> >- Query Time out Value in SQL Server is set to '0'
>> (unlimited) and query
>> >wait time is set to '-1'
>> >- I have used "the trunc. log on chkpt. database option
>> (True)".
>> >- Transaction log file property is set to auto grow by
>> 100 %
>> >- and the initial Transaction Log size is set to 300 MB
>> >But still the Long-running Transactions may cause a
>> problem i.e.
>> >1) Is there any solution, tip, suggestion or
alternative
>> to overcome the
>> >Timeout Expired Error?
>> >2) Also please tell me the originating error source,
>> (i.e. SQL Server orADO)
>> >Thanks!
>> >M.A. Naveed
>> >.
>.