Transaction of WebService Method didn't work.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
SeongRyong

Transaction of WebService Method didn't work.

Post by SeongRyong » Thu 27 Jul 2006 10:47

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??

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 28 Jul 2006 08:24

We are investigating this problem. You will be notified on results as soon as possible.

smuddasu
Posts: 9
Joined: Wed 16 Sep 2009 19:53

Post by smuddasu » Tue 13 Apr 2010 15:48

was there any resolution to this?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 14 Apr 2010 12:19

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.

Post Reply