I want to have a transaction for copying a file and then inserting a record in database.
something like below statement, but transaction doesn't cover copying file.
What's the solution?
using (TransactionScope scope1 = new TransactionScope())
{
// Copy a file
fileMgr.Move(srcFileName, destFileName);
// Insert a database record
dbMgr.ExecuteNonQuery(insertSql);
scope1.Complete();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…