C# - error on SubmitChange(); to Entity table in linked server database

edited November 2018
I am trying to transfer data from a table in a database on one server to another table in a linked-server database, but I get this error:

Unable to start a nested transaction for OLE DB provider "SQLNCLI" for linked server "GWTLMDEV2". A nested transaction was required because the XACT_ABORT option was set to OFF.

This is my code:
int count = 0;
foreach(Location_agency locAgency in Location_agencies.Skip(60000).ToList())
	GEProdTest.EDILocationAgencies.InsertOnSubmit(new LINQPad.User.GEProdTestTypes.EDILocationAgency {
		Company_id = locAgency.Company_id,
		Agency_id = locAgency.Agency_id,
		Location_id = locAgency.Location_id,
		ExternalId = locAgency.Id
	if (count == 10000)
		count = 0;

Is there a way to programmatically set XACT_ABORT to ON or OFF, or a setting that can be adjusted within LINQPad?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!