我最近開始使用現有項目,它可以與Microsoft.Practices.EnterpriseLibrary.Data對象一起使用。Microsoft.Practices.EnterpriseLibrary.Data:在一個事務中執行多個語句
現在我想在一個事務中執行多個存儲過程(1:N插入其必須全部失敗或成功)
但我不知道如何....
誰能幫助我出去了?
典型的代碼在這個項目執行SP看起來是這樣的:
Database oDatabase = DatabaseFactory.CreateDatabase(CONNECTION_STRING_KEY);
DbCommand oDbCommand = oDatabase.GetStoredProcCommand("upCustomer_Insert");
Int32 iCustomerKey = 0;
oDatabase.AddInParameter(oDbCommand, "Firstname", DbType.String, p_oCustomer.FirstName);
oDatabase.AddInParameter(oDbCommand, "Lastname", DbType.String, p_oCustomer.LastName);
oDatabase.ExecuteNonQuery(oDbCommand);
順便說一下,我會給它一個 – Michel 2010-11-19 08:50:54
,鏈接中的頁面顯示這是'Retired Content'。這個版本的entlib(或整個entlib?)不再被支持嗎? – Michel 2010-11-19 08:51:29
沒有問題 - 讓我們知道你如何繼續。 – RPM1984 2010-11-19 08:51:40