当然了,我刚才已经说过了。
sql server 2000

解决方案 »

  1.   

    你的CLIENT APPLICATION 要用OLEDB,不可以通过ODBC,这是你ADO的连接方式不支持distributed queries 。below is from msdn:
    Note  Using distributed queries in SQL Server is similar to the linked table functionality through ODBC, which was supported previously by Microsoft Access. This functionality is now built into SQL Server with OLE DB as the interface to external data.
      

  2.   

    有没有搞错啊,我只是通过两台SQL Server更新数据,怎么又牵涉到客户端程序了?这应该是SQL Server自带的功能,就是没有任何客户端程序应该也可以做到的呀。
      

  3.   

    这和代码没关系,贴上就贴上。触发器:
    CREATE TRIGGER Del_VIPInfo ON dbo.VIPUser 
    FOR DELETE 
    AS
    declare @UID int
    EXEC RemoteDB.dbcustom.dbo.sp_DelVIP @UID
    --RemoteDB为链接服务器名,dbcustom为链接服务器上对应的数据库名链接服务器上的存储过程:
    CREATE PROCEDURE sp_DelVIP(@UID int)
    as
     delete from d_userVIP where ID=@UID
      

  4.   

    CSDN没有人能解决这个问题了?
      

  5.   

    算了,我没时间就不研究了,还是用笨办法:用两个SQL语句分别更新两个数据库吧。
      

  6.   

    用set xact_abort off设置为显式事务,应该是这个问题
      

  7.   

    还是不行,我在查询分析器里运行通不过,据有些网友说是权限或配置问题,可我实在搞不清错在哪,大家看看吧。有问题欢迎指正。EXEC sp_addlinkedserver 
       'test2', 
       '', 
       'SQLOLEDB',
       NULL,
       NULL,
       'DRIVER={SQL Server};SERVER=192.168.0.1;UID=cys;PWD=aaa;',
       'cys'go
    EXEC sp_addlinkedsrvlogin 'test2', 'false', 'sa', 'cys', 'aaa'
    goset ANSI_NULLS on
    set ANSI_WARNINGS on
    set xact_abort offdeclare @UID intselect @UID=230
    BEGIN DISTRIBUTED TRANSACTION
        delete from d_used_product where user_id=@UID
        delete from RentMain where UserID=@UID
        if exists(select * from VIPSeniorUser Where VIPUserID=@UID)
        begin
            update VIPSeniorUser set PayedFlag='0' where VIPUserID=@UID
        end
        --删除链接服务器中信息--
        delete from test2.cys.dbo.d_UserVIP where ID=@UID
    COMMIT
    go
    exec sp_droplinkedsrvlogin 'test2','sa'
    go
    exec sp_dropserver 'test2'
    go结果出错,还是一样的错误信息
    服务器: 消息 7391,级别 16,状态 1,行 27
    The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
    [OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]大家帮个忙吧!
      

  8.   

    TRY BELOW:EXEC sp_addlinkedserver 
       'test2', 
       '', 
      N'SQL Server',
       NULL,
       NULL,
       'DRIVER={SQL Server};SERVER=192.168.0.1;UID=cys;PWD=aaa;',
       'cys'go
    EXEC sp_addlinkedsrvlogin 'test2', 'false', null, 'cys', 'aaa'
    goset ANSI_NULLS on
    set ANSI_WARNINGS on
    set xact_abort offdeclare @UID intselect @UID=230
    BEGIN DISTRIBUTED TRANSACTION
        delete from d_used_product where user_id=@UID
        delete from RentMain where UserID=@UID
        if exists(select * from VIPSeniorUser Where VIPUserID=@UID)
        begin
            update VIPSeniorUser set PayedFlag='0' where VIPUserID=@UID
        end
        --删除链接服务器中信息--
        delete from test2.cys.dbo.d_UserVIP where ID=@UID
    COMMIT
    --go
    --exec sp_droplinkedsrvlogin 'test2','sa'
    go
    exec sp_dropserver 'test2','droplogins'
    go
      

  9.   

    错误:
    服务器: 消息 7403,级别 16,状态 1,行 17
    Could not locate registry entry for OLE DB provider 'SQL Server'.你那能执行成功吗?
    我已经加到100分了,哪位解决了一定给分,不够再加。希望大家能先试成功后再告诉我,最好能再帮我分析一下原因,共同提高嘛:)
      

  10.   

    按照我以前的经验。使用链接服务器时候触发器在由远端调用所产生的数据更新是不会触发的。在触发器中是不让使用sp_addlinkedserveR等扩展存贮过程。
    远程事务必须启动DTC,而且网络设置与两台服务器的SQL版本好象都协调好,反正很麻烦,后来我也把远程事务给取消了不用。
      

  11.   

    错误提示是:
    The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction
     即:OLE DB不能启动一个分布式事务。
    而在你的代码里:BEGIN DISTRIBUTED TRANSACTION
        所以,你还应往如何设置能运行分布式事务方面想,
      

  12.   

    提供程序同时支持
    ItransactionLocal

    ITransactionJoin(用于分布式事务)
    才可以用写操作
      

  13.   

    可检查一下
    SQL Server 企业管理器中的“链接服务器属性”中的选项是否正确。 
      

  14.   

    TO:blackcatiii(ljh) SORRY PLS TRY AGAIN:
    EXEC sp_addlinkedserver 
       'test2', 
       '', 
      N'SQLOLEDB', //MODIFY
       NULL,
       NULL,
       'DRIVER={SQL Server};SERVER=192.168.0.1;UID=cys;PWD=aaa;',
       'cys'go
    EXEC sp_addlinkedsrvlogin 'test2', 'false', null, 'cys', 'aaa'
    goset ANSI_NULLS on
    set ANSI_WARNINGS on
    set xact_abort offdeclare @UID intselect @UID=230
    BEGIN DISTRIBUTED TRANSACTION
        delete from d_used_product where user_id=@UID
        delete from RentMain where UserID=@UID
        if exists(select * from VIPSeniorUser Where VIPUserID=@UID)
        begin
            update VIPSeniorUser set PayedFlag='0' where VIPUserID=@UID
        end
        --删除链接服务器中信息--
        delete from test2.cys.dbo.d_UserVIP where ID=@UID
    COMMIT
    --go
    --exec sp_droplinkedsrvlogin 'test2','sa'
    go
    exec sp_dropserver 'test2','droplogins'
    go
    错误:
    服务器: 消息 7403,级别 16,状态 1,行 17
    Could not locate registry entry for OLE DB provider 'SQL Server'.
    THIS MEAN:
    This error message indicates one of the following: The OLE DB provider is not registered properly.
    The name of the provider used in the provider_name parameter of sp_addlinkedserver (or specified in the OPENROWSET function) is incorrect.