Scripted BO without transaction manager?

Version 9.1

 

I'm attempting to implement a scripted BO using that uses the IDataSetAccess interface, and manages the connection internally. This is very similar to the examples in C:\Program Files (x86)\Metastorm\BPM\Sample Processes\sample 3

 

In the Read() method I use standard .NET objects to make the connection to an external SQL-server DB and return a dataset.

 

publicSystem.Data.DataSet Read()

{

  DataSet ds = new DataSet();

  SqlConnection con = new SqlConnection(this.ConnectionString);

  SqlCommand cmd = new SqlCommand("SELECT..... ");

  cmd.CommandType = CommandType.Text;

  cmd.Connection = con;

 

  cmd.Connection.Open();

  SqlDataAdapter da = newSqlDataAdapter(cmd);

  da.Fill(ds);

  cmd.Connection.Close();

 return ds;

}

 

Problem is, somehow this connection is expecting to use a transaction manager. The DB does not have the transaction manager enabled and it is not practical to do so. Why is this expecting to use a transaction manager? Can I change that?

Tagged:

Comments

  • I not 100% sure but I think you can tweak your ConnectionString member to tell your SqlConnection (con) to not use DTC.

     

    See here: http://msdn.microsoft.com/en-us/library/ms254973.aspx

     

    (excerpt)

     

    Automatically Enlisting in a Distributed Transaction

    Automatic enlistment is the default (and preferred) way of integrating ADO.NET connections with System.Transactions. A connection object will automatically enlist in an existing distributed transaction if it determines that a transaction is active, which, inSystem.Transaction terms, means that Transaction.Current is not null. Automatic transaction enlistment occurs when the connection is opened. It will not happen after that even if a command is executed inside of a transaction scope. You can disable auto-enlistment in existing transactions by specifying Enlist=false as a connection string parameter for a ConnectionString, or OLE DB Services=-7 as a connection string parameter for an ConnectionString. For more information on Oracle and ODBC connection string parameters, see ConnectionString and ConnectionString.

     

    *edit*

    In case it isn't clear, I'm suggesting to just try throwing "Enlist=false" or "OLE DB Services=-7" on the end of your ConnectionString string.

    *edit*

  • That worked! Thanks for the quick turn.