C
Chung Tsen
Using C#.NET and SQL Server 2000
When we execute a stored procedure wrapped in SQLTransaction with 14
updates / 8 inserts, from within our C# application -- it takes about
10 minutes to execute.
If we take out the SQLTransaction, it takes about 20~30 seconds to
execute.
The stored procedure is very simple with a series of
updates/selects/inserts from one to the next.
Here is a small snippet of the code with transaction..
Cn.Open();
SqlTransaction SQLTrans = cn.BeginTransaction();
SqlCommand dc = new SqlCommand(sCmdText,Cn);
dc.CommandType = CommandType.Text;
dc.Transaction = SQLTrans;
return dc.ExecuteNonQuery();
Cn.Close();
We know transaction requires the server to do more work in case of
failures, but... it shouldn't be this much slower, right ? If anyone
could tell us why it becomes so much slower when using SQLTransaction,
and possible solutions, it'd be a great help!
Thanks in advance,
Chung
When we execute a stored procedure wrapped in SQLTransaction with 14
updates / 8 inserts, from within our C# application -- it takes about
10 minutes to execute.
If we take out the SQLTransaction, it takes about 20~30 seconds to
execute.
The stored procedure is very simple with a series of
updates/selects/inserts from one to the next.
Here is a small snippet of the code with transaction..
Cn.Open();
SqlTransaction SQLTrans = cn.BeginTransaction();
SqlCommand dc = new SqlCommand(sCmdText,Cn);
dc.CommandType = CommandType.Text;
dc.Transaction = SQLTrans;
return dc.ExecuteNonQuery();
Cn.Close();
We know transaction requires the server to do more work in case of
failures, but... it shouldn't be this much slower, right ? If anyone
could tell us why it becomes so much slower when using SQLTransaction,
and possible solutions, it'd be a great help!
Thanks in advance,
Chung