HighTechTalks DotNet Forums  

On TransactionScope and TableAdapter

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss On TransactionScope and TableAdapter in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ajit
 
Posts: n/a

Default On TransactionScope and TableAdapter - 11-08-2007 , 01:08 PM






Hi,

We are developing a WCF service using .NET 3.0.

The target platform : Win XP,SP 2.0

In the data access layer, we use ADO .NET to connect to the SQL Express
database.Data access layer is implemented as typed datasets with tableadapter
for each table.The service implementation at the business logic layer uses
TransactionScope as shown below.

void MyService()
{

....

using (TransactionScope scope = new TransactionScope())
{

using(Tableadapter1)
{
using(TableAdapter2)
{
}

}
scope.Complete();
}

}
All the table adapters are from the same database.Multiple service
methods having similar implementation ( uses more or less the same table
adapters ) can be called by the different clients simultaneously.

(1) We are getting Transaction deadlock.Pasted below is the detailed error
message.We have gone thorough the order in which the tables are accessed.Its
more or less the same in different methods.How do we eleminate or minimise
these deadlocks ?

System.Data.SqlClient.SqlException: Transaction (Process ID 69) was
deadlocked on lock resources with another process and has been chosen as the
deadlock victim. Rerun the transaction. at
System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean
breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

(2)Some time the same set of operations give the Timeout error with having
used the max connection pool.How do we change the default timeout period /
pool size ?

System.InvalidOperationException: Timeout expired. The timeout period
elapsed prior to obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and max pool size was
reached.
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset,
DataTable[] datatables, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32
startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)


With Regards
Ajit

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.