Hi I am new to CSLA.net, I want to learn more about it.
When I am trying to delete a record from DB2 database, I am getting the below error and inner exception
at the line "connEmp.Open();" in my code sample.
Error: "ERROR [58005] [IBM][DB2/6000] SQL0998N Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-8004D026". SQLSTATE=58005"
Inner Exception: "_COMPlusExceptioncode -532459699"
Below are two ways I tried.
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(Criteria criteria)
{
using (DB2Connection connEmp = new DB2Connection(Databases.EmpDBConnection))
{
connEmp.Open();
using (DB2Command cmdEmp = connEmp.CreateCommand())
{
string strSQL = "SP_DELETE_Employee";
cmdEmp.CommandType = CommandType.StoredProcedure;
cmdEmp.CommandText = strSQL;
cmdEmp.Parameters.Add("EmpID",criteria.EmpId);
cmdEmp.ExecuteNonQuery();
}
}
}
and
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(Criteria criteria)
{
Database dbEmp = DatabaseFactory.CreateDatabase();
System.Data.Common.DbCommand dbCommand = dbEmp.GetStoredProcCommand("SP_DELETE_Employee");
dbEmp.AddInParameter(dbCommand, "EmpID", DbType.Int16, criteria.empId);
dbEmp.ExecuteNonQuery(dbCommand);
}
Distributed transaction coordinator service also running on my machine.
I added below code in web.config to change the default transaction time out
<system.transactions>
<defaultSettings timeout="00:010:00" />
</system.transactions>
I am using below softwares list
Visual Studio 2005,ASP.NET 2.0,CSLA.NET 3.0.4,UDB DB2 9.1.2 database,C#.NET and Microsoft Enterprise Library 3.1 and Windows XP with SP2.
Is it mandatory to run the MDT service to work with CSLA Transactions, if not can you please advise me the best solution to resolve this problem.
If I removed transaction attribute ([Transactional(TransactionalTypes.TransactionScope)]) it was working fine in both the cases.
Can some one please help me to work with transactions in CSLA.net.