ORA-01453 SET TRANSACTION must be first statement of transactionCause: A transaction was not processed properly because the SET TRANSACTION statement was not the first statement.Action: Commit or roll back the current transaction before using the statement SET TRANSACTION.
OracleTransaction trans = conn.BeginTransaction(IsolationLevel.ReadCommitted);
try
{
for( int i = 0; i < inSQL.Length; i++ )
{
SQLRowIndex = i;
DBErrorSQL = inSQL[i];
if ( inSQL[ i ].CompareTo( "" ) > 0 )
{
OracleCommand OracleCommand = new OracleCommand();
OracleCommand.Connection = conn;
OracleCommand.Transaction = trans; OracleCommand.CommandText = inSQL[i]; OracleCommand.ExecuteNonQuery();
}
}
trans.Commit();
rtn = true;
}
catch( Exception e )
.......
--写的好.出现错误我想可能与你传递的sql有关系.
when others then
....
end;
这样就好了!
应该是这样:
。
OracleConnection conn = new OracleConnection( inConnString );
OracleTransaction trans = conn.BeginTransaction(IsolationLevel.ReadCommitted);
try
{}
。
谢谢!
为什么要在open之前创建 transaction?