begin tran 
    set nocount on 
    insert  ...() values() 
    select max(sn)  from ... 
    set nocount off
commit tran 

解决方案 »

  1.   

    No idea about why nocount causes this.
    http://msdn.microsoft.com/en-us/library/ms189837.aspx
      

  2.   

    把set nocount on去掉或者不查max(sn),插入都正常。程序没查出有什么问题。
      

  3.   

    发现问题,因为set nocount on会取消插入语句产生的记录集,在使用movefirst()时,ADO会因为找不到头一个记录集而自动把这个事务再重新执行一遍。怎么样选中第二个记录集啊?郁闷呐