473,464 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ExecuteXmlReader deadlocked exception; new to framework 1.1

When executing ExecuteXmlReader() against a table where records are
being inserted, I get:

9/5/2003 8:39:47 AM Transaction (Process ID 66) was deadlocked on lock
resources with another process and has been chosen as the deadlock
victim. Rerun the transaction.
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteXmlReader( )

The 1.1 Framework help says this is design, that an SqlException is
raised:

An exception occurred while executing the command against a locked
row. This exception is not generated when using Microsoft .NET
Framework version 1.0.

Has anyone found a workaround to this?

Thanks in advance.

---Adam Smith
Nov 15 '05 #1
1 2363
You can never be sure what another programmer might do, or in our case
a QA tester executing an sql script. I found a solution, one that
still raises an exception, but does not "deadlock" and cause data
loss.

It involves the database setting SET LOCK_TIMEOUT 0

For example:

try
{
dbCommand.CommandText = "SET LOCK_TIMEOUT 0";
dbCommand.ExecuteNonQuery();
dbCommand.CommandType = CommandType.StoredProcedure;

dbCommand.CommandText = "some_stored_procedure";

xmlReader = dbCommand.ExecuteXmlReader();
}
catch(Exception e)
{
log(e);
}

---Adam Smith

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:<O#**************@tk2msftngp13.phx.gbl>...
Adam,

Well, one has to ask, what do you have running somewhere else that is
locking up the row for so long? I think that if you address that, then the
exception becomes a moot point. If I received this error, I would think
that it is a flaw in the design somewhere.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Adam Smith" <ad*********@hotmail.com> wrote in message
news:cd**************************@posting.google.c om...
When executing ExecuteXmlReader() against a table where records are
being inserted, I get:

9/5/2003 8:39:47 AM Transaction (Process ID 66) was deadlocked on lock
resources with another process and has been chosen as the deadlock
victim. Rerun the transaction.
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteXmlReader( )

The 1.1 Framework help says this is design, that an SqlException is
raised:

An exception occurred while executing the command against a locked
row. This exception is not generated when using Microsoft .NET
Framework version 1.0.

Has anyone found a workaround to this?

Thanks in advance.

---Adam Smith

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark Miller | last post by:
I have an sp that outputs multiple xml fragments w/ no root. The sp calls individual sp's to output the correct set of data and each "type" has different fields. ex.: <LEADERBOARD...
2
by: Dylan Phillips | last post by:
A strang error is occurring when I run the following code: SqlConnection c = new SqlConnection(); c.ConnectionString = "Initial Catalog=Northwind;user id=sa;password=kat1ie;Data Source=server";...
5
by: adolf garlic | last post by:
Im trying to return xml from sql. The xml is made up of different fragments, some using FOR XML ... syntax. The result is a valid xml doc. There is a working stored proc that returns the xml In...
0
by: Steve Harclerode | last post by:
I'm trying to use an SqlCommand.ExecuteXmlReader() to write data to an XML file. Most of the code is below. The result I'm seeing is that the schema file is written and looks good, but the XML file...
4
by: Steve Harclerode | last post by:
I tried this on another newsgroup but no nibbles -- I'm hoping someone might be able to help on this csharp group -- I'm trying to use SqlCommand.ExecuteXmlReader() to write data to an XML file....
1
by: bmmodi | last post by:
Hello, We have three webservers that host the same web application (written in VB.NET running on .NET Framework 1.0 SP2). We receive the following error (aspnet_wp.exe (PID: 1864) was recycled...
2
by: Antonio Concepcion | last post by:
Hi! We have an ASP.NET web site experiencing errors saying that aspnet_wp.exe got into a deadlock state and was recycled. Specifically the Client browser gets the following message: ...
1
by: Risen | last post by:
Hi, When I use sqlcommand.ExecuteXmlReader to receive Sql Server 2005's table data, it not work! my code is below: private static void CreateXMLReader(string queryString,string...
5
by: gurufordy | last post by:
Hello all. I have a stored procedure that take no parameters and just returns XML as below: CREATE PROCEDURE . AS SELECT vchrOne, vchrTwo, vchrThree
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.