public
void
beginTransation()
... {
this.openConnection();
this.transaction = this.conn.BeginTransaction();
this.command = this.conn.CreateCommand();
command.Transaction = this.transaction;
//transaction.Begin();
}
public void commitTransation()
... {
transaction.Commit();
}
public void rollBackTransation()
... {
transaction.Rollback();
}
... {
this.openConnection();
this.transaction = this.conn.BeginTransaction();
this.command = this.conn.CreateCommand();
command.Transaction = this.transaction;
//transaction.Begin();
}
public void commitTransation()
... {
transaction.Commit();
}
public void rollBackTransation()
... {
transaction.Rollback();
}
首先要保证你的事务处理的sql,在同一个connection中,其中transaction.Begin();不能加上,加上则出现,如下错误:
The transaction assigned to this command must be the most nested pending local transaction.
就是因为这个,害我找了很久的原因,唉。