UniTransaction and ParameterCheck issue (Sql Server)

UniTransaction and ParameterCheck issue (Sql Server)

Postby idem84 » Fri 01 Aug 2014 05:44

Hi, im having issues only when mixing UniTransaction and enabling ParameterCheck (using SqlServer and last dotconnect universal version of july 31 2014)
Exception: DeriveParameters requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.
stacktrace at the end of post
Thanks in advance
sample code

var uniConnection = new UniConnection(MicroConnectionString);
uniConnection.Open();
var uniCommand = new UniCommand(); //uniConnection.CreateCommand();
UniTransaction uniTransaction;
//Start a local transaction
uniTransaction = uniConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
//Assign transaction object for a pending local transaction
uniCommand.Transaction = uniTransaction;
uniCommand.Connection = uniConnection;


try
{
uniCommand.CommandType = commandType;
uniCommand.CommandText = commandText;
uniCommand.CommandTimeout = commandTimeOut;

//if (commandType == CommandType.StoredProcedure)
// uniCommand.ParameterCheck = parameterCheck; // ***** Dont work with transaction (throws in ExecuteNonQuery below) using SqlServer as provider


foreach (var p in uniParameters) uniCommand.Parameters.Add(p);

var res = uniCommand.ExecuteNonQuery(); //Here throws if i enable parametercheck
uniCommand.Transaction.Commit();
UpdateParameters(parameters, uniParameters);
return res;
}
catch (Exception ex)
{
uniTransaction.Rollback();
throw new Exception(ex.Message + " Rollback executed!", ex.InnerException);
}
finally
{
uniConnection.Close();
}


StackTrace when exception throws if parametercheck=true
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.DeriveParameters()
at System.Data.SqlClient.SqlCommandBuilder.DeriveParameters(SqlCommand command)
at Devart.Data.Universal.SqlServerProvider.DeriveParameters(IDbCommand command)
at Devart.Data.Universal.UniCommand.DescribeProcedure(String name)
at Devart.Data.Universal.UniCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at Devart.Common.DbCommandBase.ExecuteNonQuery()
idem84
 
Posts: 50
Joined: Thu 04 Apr 2013 19:12

Re: UniTransaction and ParameterCheck issue (Sql Server)

Postby Pinturiccio » Tue 05 Aug 2014 10:25

We have reproduced the issue. We will investigate it and post here about the results as soon as possible.
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44

Re: UniTransaction and ParameterCheck issue (Sql Server)

Postby Pinturiccio » Mon 11 Aug 2014 12:53

We have fixed the bug with UniCommand.ParameterCheck property when using transaction while working with SQL Server. We will post here when the corresponding build of dotConnect Universal is available for download.
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44

Re: UniTransaction and ParameterCheck issue (Sql Server)

Postby Pinturiccio » Thu 14 Aug 2014 15:25

New build of dotConnect Universal 3.50.722 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/universal/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=30169
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect Universal