选中Microsoft SQL Servers-->工具栏,工具-->选项-->高级-->查询超时-->改为0选中Microsoft SQL Servers-->工具栏,工具-->选项-->高级-->连接超时-->改为0
ADONonnectionTimeout 连接时间长一点;
CommandTimeout 执行时间长一点!

解决方案 »

  1.   


    超时:
    1:企业管理器->服务器->属性->连接->查询超时(改为0或一个较大的数)
    2:ADO的连接超时属性connectiontimeout 设大点.
    3:ADO的CommandTimeout设大点
      

  2.   

    /**********  加锁   ***************
    设table1(A,B,C)
    A    B    C
    a1   b1   c1
    a2   b2   c2
    a3   b3   c31)排它锁
    新建两个连接
    在第一个连接中执行以下语句
    begin tran
       update table1
       set A='aa'
       where B='b2'
       waitfor delay '00:00:30'  --等待30秒
    commit tran
    在第二个连接中执行以下语句
    begin tran
       select * from table1
       where B='b2'   
    commit tran若同时执行上述两个语句,则select查询必须等待update执行完毕才能执行即要等待30秒2)共享锁
    在第一个连接中执行以下语句
    begin tran
       select * from table1 holdlock -holdlock人为加锁
       where B='b2' 
       waitfor delay '00:00:30'  --等待30秒
    commit tran在第二个连接中执行以下语句
    begin tran
       select A,C from table1
       where B='b2' 
       update table1
       set A='aa'
       where B='b2'   
    commit tran若同时执行上述两个语句,则第二个连接中的select查询可以执行
    而update必须等待第一个连接中的共享锁结束后才能执行 即要等待30秒3)死锁
    增设table2(D,E)
    D    E
    d1   e1
    d2   e2
    在第一个连接中执行以下语句
    begin tran
       update table1
       set A='aa'
       where B='b2' 
       waitfor  delay '00:00:30'
       update table2
       set D='d5'
       where E='e1' 
    commit tran
       
    在第二个连接中执行以下语句
    begin tran
       update table2
       set D='d5'
       where E='e1' 
       waitfor  delay '00:00:10'
       update table1
       set A='aa'
       where B='b2'  
    commit tran同时执行,系统会检测出死锁,并中止进程
    --------------------------------------------------------------
    SET IMPLICIT_TRANSACTIONS  ON --用户每次必须显式提交或回滚。否则当用户断开连接时,
                                  --事务及其所包含的所有数据更改将回滚SET IMPLICIT_TRANSACTIONS  OFF --自动提交模式。在自动提交模式下,如果各个语句成功
                                   --完成则提交。
      

  3.   

    除了马可的第二条方法没有试,其它的还是不行。程序没有响应  55555555555555~~~~~~~~
    怎么办呢??而且属性中没有找到connectiontimeout.只有commandtimeout.