Forum Stats

  • 3,814,956 Users
  • 2,258,936 Discussions
  • 7,892,896 Comments

Discussions

SOS -ODP .NET Different Database Type Transaction

991643
991643 Member Posts: 2
Hi,EveryOne:
I want to use ODP.net Instead of Ado.NET .But a transaction problem Puzzle me.
The Detail code is
string xmldata = "<data>nihao </data>";
using (TransactionScope scope = new TransactionScope())
{

string sql = string.Empty;
for (int i = 1; i <= 300; i++)
{
sql = "insert into Test(id,ChineseCode,EnglishCode) select '" + Guid.NewGuid().ToString() + "','" + Guid.NewGuid().ToString() + "','" + Guid.NewGuid().ToString() + "'";
SqlFunction.ExecSql(sql);
}
sql = " delete from Test123 ";
OraFunction.ExecSql(sql);
sql = "insert into Test123(id,code,data) select '" + Guid.NewGuid().ToString() + "','001','" + xmldata + "' from dual ";
for (int i = 1; i <= 300; i++)
{
OraFunction.ExecSql(sql);
}
scope.Complete();
}

The problem is
I find sql = " delete from Test123 "; may be not execute,
but if only oracle database sql, delete sql can right execute
the same code use ado.net system.oracle delete sql can right execute too
who can explain the reasons? Thanks!
Tagged:
This discussion has been closed.