473,395 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Migrating to ADO.NET and locks

I just started to work with ADO.NET and I had some problem with locks that
it caused on our sql server.
In classic ADO I didnt close the connection (sloppy of me I know) and it
didnt cause many problems.

After executing the following code in a ASP.NEt :

Dim conn As New SqlConnection("Data Source=(local);Initial
Catalog=xxx;user=xxx;pwd=xxx")
Dim sql As New SqlCommand("SELECT * FROM Page", conn)
conn.Open()
sql.ExecuteReader()

The following locks are itroduced :

================================================== ==========================
======
Object Lock Type Mode Status Owner Index Resource
Spider DB S GRANT Sess
Spider.dbo.Page TAB IS GRANT Xact
Spider.dbo.Page KEY S GRANT Xact PK_Page (c8006e1f5864)
Spider.dbo.Page PAG IS GRANT Xact PK_Page 1:169
Spider.dbo.Page PAG IS GRANT Xact tPage 1:110
Spider.dbo.Page RID S GRANT Xact tPage 1:110:4
================================================== ==========================
======

When I want to empty the Page table (delete from page) the command doesnt
success bacause of the locks
(I understand that Xact is a transaction

When I close the connection (conn.Close) I get a nicer picture regarding
locks :

================================================== ==========================
======
Object Lock Type Mode Status Owner Index Resource
Spider DB S GRANT Sess
================================================== ==========================
======

And everything works fine just like in the good old classic ado days.

so my question is : Why is it that with ADO.NET its much more important to
close the connection ?

It seems that a datareader starts a transaction automaticaly. Do I realy
need this?

Nov 17 '05 #1
0 854

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

Similar topics

2
by: Tom Pester | last post by:
I just started to work with ADO.NET and I had some problem with locks that it caused on our sql server. In classic ADO I didnt close the connection (sloppy of me I know) and it didnt cause many...
4
by: Alex Callea | last post by:
Hi there, We have a web application handling thousands of requests per seconds reading sql server data which is heavily updated. We are generally experiencing no performance problems. On some...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
1
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.