ORA-02041 client database did not begin a transaction
Cause: An update occurred at a coordinated database without the coordinator
beginning a distributed transaction. This may happen if a stored procedure
commits and then performs updates, and the stored procedure is invoked
remotely. It could also happen if an external transaction monitor violates the XA
protocol.
Action: If the cause is the former, check that any commit is not followed by an
update.

解决方案 »

  1.   

    oraConn.Open();
    OracleTransaction oraTrans;
    oraTrans = oraConn.BeginTransaction(IsolationLevel.ReadCommitted); // *******************************************************
    // * 存储过程:pub.dss_prc_ka_1(开始日期,结束日期,航段)
    // * 数 据 表:dss_ka_1_v
    //********************************************************
    #region 查询航段,默认为空串
    string strSegment ="";
    if(ddlSegment1.SelectedItem!=null && ddlSegment1.SelectedIndex>0 &&
    ddlSegment2.SelectedItem!=null && ddlSegment2.SelectedIndex>0)
    {
    strSegment =ddlSegment1.SelectedValue.ToString() + ddlSegment2.SelectedValue.ToString();
    }
    else
    {
    strSegment ="";
    }
    #endregion  //调用存储过程查询统计结果
    string strProcName ="pub.dss_prc_ka_1";  //存储过程名称
    int iResult = OracleHelper.ExecuteNonQuery(oraTrans,CommandType.StoredProcedure,strProcName,
    new OracleParameter("ls_date1",ucStartDate.SelectDate.ToString()),
    new OracleParameter("ls_date2",ucEndDate.SelectDate.ToString()),
    new OracleParameter("ls_segment",OracleType.VarChar,6,ParameterDirection.Input,true,0,0,"",DataRowVersion.Default,strSegment));