I need to update a table in the linked server in the procedure, but I could not succeed.
The SELECT
statement succeeds, but I cannot UPDATE
or INSERT
.
This procedure worked in the web application(ASP) and in SQL Server Management Studio:
ALTER PROCEDURE sp_SELECT
(@ID BIGINT)
AS
SELECT FIRM_NAME
FROM [8.0.0.11\SQL2].MyDatabase.dbo.SYST_FIRM
WHERE FIRM_ID = @ID
GO
This procedure did not work in the web application(ASP), but it did work in SQL Server Management Studio:
ALTER PROCEDURE sp_UPDATE
(@ID BIGINT,
@NAME_NEW NVARCHAR(50))
AS
UPDATE [8.0.0.11\SQL2].MyDatabase.dbo.SYST_FIRM
SET FIRM_NAME = @NAME_NEW
WHERE FIRM_ID = @ID
GO
My connection string format in App:
string _cs = "Data Source={0};Initial Catalog={1};User Id={2};Password={3};Connection Timeout=300;";
Local firewall is off.
My linked server properties:
Note: the web application and SQL Server Management Studio connect to SQL Server with the same username.
Error:
The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server was unable to begin a distributed transaction.
I tried all messages in:
I'm sorry for my bad English.
I used Google Translate.
Thanks all.