Page 1 of 1

Transaction of WebService Method didn't work.

Posted: Thu 27 Jul 2006 10:47
by SeongRyong
Hi....

I made some webservice using Enterprise Library 2.0 & MySQLDirect .NET.

That code is on below.

------------------------------------------------------------------------------


[WebMethod(TransactionOption = TransactionOption.Required)]
public bool InsertUniverse()
{
Database db = DatabaseFactory.CreateDatabase();

string sqlCommand = "insert into Test values (@testid, @testname)";

DbCommand dbcommand = db.GetSqlStringCommand(sqlCommand);
db.AddInParameter(dbcommand, "@testid", DbType.String, "002");
db.AddInParameter(dbcommand, "@testname", DbType.String, "testtest");

db.ExecuteNonQuery(dbcommand);

dbcommand = db.GetSqlStringCommand(sqlCommand);
db.AddInParameter(dbcommand, "@testid", DbType.String, "002");
db.AddInParameter(dbcommand, "@testname", DbType.String, "testtest");

db.ExecuteNonQuery(dbcommand);


return true;
}


------------------------------------------------------------------------------

I want that exception occurred and then no low is inserted.
First command is executed and second command occur dup exception but first command is not rollbacked.

Maybe, I think the Transaction configuration of WebMethod ([WebMethod(TransactionOption = TransactionOption.Required)]) didn't work.

This is bug?? If not, why this case is occurred??

Posted: Fri 28 Jul 2006 08:24
by Alexey
We are investigating this problem. You will be notified on results as soon as possible.

Posted: Tue 13 Apr 2010 15:48
by smuddasu
was there any resolution to this?

Posted: Wed 14 Apr 2010 12:19
by Shalex
I have tried the 5.70.120 version of dotConnect for MySQL with the code from SeongRyong's post in the ASP.NET Web Service Application project against Microsoft Enterprise Library 4.1. If the second command fails, the exception is thrown, and the first command is not commited (insert is not made).

If you encounter any difficulties with the 5.70.120 version, please post here the exact steps we should follow to reproduce the issue.