TrasactionScope.....SqlServer 2000TrasactionScope.....SqlServer 2000
Old forum URL: forums.lhotka.net/forums/t/6968.aspx
MikeB posted on Tuesday, May 19, 2009
I cannot use TransactionScope because my database is on SqlServer 2000 which does not support promotable transactions. It requires the MSDTC and I don't want to install/enable this on the server.... Any suggestions?
Mike B
RockfordLhotka replied on Tuesday, May 19, 2009
As far as I know you have the following options
With DTC:
- TransactionScope
- Enterprise Services
Without DTC:
- Manual transactions at the ADO.NET level
- Manual transactions at the stored procedure level
- Upgrade to a more recent version of SQL Server so you can use TransactionScope
triplea replied on Friday, May 22, 2009
I had to do this some time ago. I digged up some code which I used from an example online (couldn't find the bookmark so sorry can't give any credit )triplea replied on Friday, May 22, 2009
I had to do this some time ago. I digged up some code which I used from an example online (couldn't find the bookmark so sorry can't give any credit ... )
Add the attached file to your solution and then to use it in your DataPortal do the following:
using
(SqlConnection sqlConnection = new SqlConnection("your database"))
{
using (TransactionScope ts = new TransactionScope())
{
DatabaseTransactionAdapter dbAdapter = new DatabaseTransactionAdapter(sqlConnection);
sqlConnection.Open();
dbAdapter.Begin();
...
}
}
Copyright (c) Marimer LLC