[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sql Server 0x80004005 deadlock error using ADO

Posted on 2009-12-16
4
Medium Priority
?
964 Views
Last Modified: 2012-06-27
I am using ADO and I get a deadlock error.  When I query the errors collection I get back 0x80004005 and the typical deadlock error message.  I know that other messages can come back from the database with the same error number.  Is there any way to distinguish the difference other than searching through the message.  We handle our code execution different if it is a deadlock.  I cant search the message because other languages are used.

I am using this provider
Provider=SQLOLEDB.1;Data Source=devmacine;Initial Catalog=AAD;Persist Security Info=False

0
Comment
Question by:PaulSlechta
  • 3
4 Comments
 
LVL 9

Expert Comment

by:sarabhai
ID: 26065399
try out following with ur values.

'* set your variables here
serverIP = "192.168.100.1"
serverPORT = "1433" '* default port is 1433/TCP
serverDB = "Northwind"
serverLOGIN = "login"
serverPASSWORD = "pass"

'* open connection
Dim con
Set con = Server.CreateObject("ADODB.Connection")
con.ConnectionString = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=" & serverIP & "," & serverPORT & ";" & _
"Initial Catalog=" & serverDB & ";" & _
"User ID=" & serverLOGIN & ";" & _
"Password=" & serverPASSWORD & ";" & _
"Connect Timeout=5;Pooling=False"
0
 

Author Comment

by:PaulSlechta
ID: 26065557
No difference.
0
 

Author Comment

by:PaulSlechta
ID: 26067073
This message is what I need.  1205 is the number I need to get.  All I get is the Message and 0x80004005

Msg 1205, Level 13, State 51, Line 1
Transaction (Process ID 54) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
0
 

Accepted Solution

by:
PaulSlechta earned 0 total points
ID: 26143384
I found the solution to this issue. In the errors collection the is a property SQLState.  The value is a code returned from SQL Server itself.  The value for a deadlock returned by SQLState is 40001.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question