473,803 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ExecuteXmlReade r deadlocked exception; new to framework 1.1

When executing ExecuteXmlReade r() 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.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteXmlRe ader()

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 2379
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.Comma ndText = "SET LOCK_TIMEOUT 0";
dbCommand.Execu teNonQuery();
dbCommand.Comma ndType = CommandType.Sto redProcedure;

dbCommand.Comma ndText = "some_stored_pr ocedure";

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

---Adam Smith

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote in message news:<O#******* *******@tk2msft ngp13.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************* *@exisconsultin g.com

"Adam Smith" <ad*********@ho tmail.com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
When executing ExecuteXmlReade r() 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.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteXmlRe ader()

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
7739
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 @Type='Rushing'> <LEADER @Carries=''/> </LEADERBOARD> <LEADERBOARD @Type='QBRating'> <LEADER @Rating='' @CompletionPct=''/>
2
4939
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"; c.Open(); SqlCommand command = c.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = "select Customers.customerid, customers.companyname, " +
5
6801
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 .net i'm having problems loading this up. I've now tried installing sqlxml managed classes and the following appears to work when stepping through, but the result just disappears.
0
1195
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 has no data other than an empty <root> node. Is there something simple I'm missing? BTW, running the same query in query analyzer returns 7 nodes. Thanks -- Steve --------------------
4
15171
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. 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 has no data other than an empty <root> node. Is there something simple I'm missing? BTW, running the same query in query analyzer...
1
1679
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 because it was suspected to be in a deadlocked state. It did not send any responses for pending requests in the last 180 seconds.) every few days on ONLY ONE of the three servers. At the point when the error occurs, the CPU locks up at 100%. ...
2
2837
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: ***************************** Server Application Unavailable The web application you are attempting to access on this web server is currently
1
4930
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 connectionString) { using (SqlConnection connection = new SqlConnection(connectionString)) {
5
2316
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
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5503
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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 we have to send another system

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.