可以通过事务来解决这个问题。 只需在执行数据插入的语句前加上 m_pConnection->BeginTrans(); 在执行数据插入的语句后加上 m_pConnection->CommitTrans();