相关疑难解决方法(0)

"操作对事务状态无效"错误和事务范围

当我尝试调用包含SELECT语句的存储过程时,我收到以下错误:

该操作对交易状态无效

这是我的电话结构:

public void MyAddUpdateMethod()
{

    using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew))
    {
        using(SQLServer Sql = new SQLServer(this.m_connstring))
        {
            //do my first add update statement

            //do my call to the select statement sp
            bool DoesRecordExist = this.SelectStatementCall(id)
        }
    }
}

public bool SelectStatementCall(System.Guid id)
{
    using(SQLServer Sql = new SQLServer(this.m_connstring)) //breaks on this line
    {
        //create parameters
        //
    }
}
Run Code Online (Sandbox Code Playgroud)

我在问题中创建了另一个与同一数据库的连接的问题吗?

.net c# sql-server transactions transactionscope

59
推荐指数
6
解决办法
9万
查看次数

标签 统计

.net ×1

c# ×1

sql-server ×1

transactions ×1

transactionscope ×1