SqlConnection / SQLTransaction issue (.NET 2.0 BETA 2)

Has the way SqlConnection and SqlTransaction works changed for BETA 2? I can't find anything but the following code no longer works and throws a "Connection Closed" exception when conn.BeginTransaction executes, even thou conn.Open() seems to work.

Cheers

Simon


using (SqlConnection conn =new SqlConnection(dbConString))
{
conn.Open();
using (SqlTransaction trans = conn.BeginTransaction())
{
try
{
.
.
.
trans.Commit();
}
catch
{
trans.Rollback();
}
}
}

[981 byte] By [SimonMiddlemiss] at [2008-2-13]
# 1
I just tested this with Beta2 and Sql Server 2000 database and it worked fine.

What database are your trying to connect to? And what connection string are you using?

DavidM.Kean at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Hi,

I pasted the same code into VS2005 Beta 2 and ran it with my own connectionstring to a local SQL Server 2005 DB and it worked fine.

Try restarting the SQL Server service once and see if that helps.

Regards,
Vikram

Vikram at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified