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??
Transaction of WebService Method didn't work.
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.
If you encounter any difficulties with the 5.70.120 version, please post here the exact steps we should follow to reproduce the issue.