Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2005, 01:20 AM
Authorized User
 
Join Date: Dec 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default SELECT with READPAST doesn't work !

Hi all,

I've written a multiuser software in VB.NET using ADO.NET and MSSQL Server 2000.

User #1 performs a
SELECT ... FROM Table1 WITH (ROWLOCK)... ,

the connection of User #1 being

cnx = New SqlConnection(SetConString(10))
cnx.Open()
trx = cnx.BeginTransaction(IsolationLevel.Serializable)

da = New SqlDataAdapter(Sca, cnx)
da.SelectCommand.Transaction = trx
da.Fill(ds, "TabDetails")
...

At the same time, User #2 does a
SELECT ... FROM Table1 WITH (READPAST) ....the connection of User #2 being

[blue]cnx = New SqlConnection(SetConString(10))
cnx.Open()
trx = cnx.BeginTransaction(IsolationLevel.ReadCommitted)

da = New SqlDataAdapter(sSQL, cnx)
da.SelectCommand.Transaction = trx
da.Fill(ds, "TabSursa")
...
cnx, trx being the connection and transaction, respectively.

Connection of User #1 is open a long time, much longer than that of User #2.

The problem : Row locking does work, but not READPAST.

User #2 still sees the record (row) that User #1 has accessed, although the row is locked (I tried to access it and it doesn't work, which is what SQL Server should do), and although the SELECT of User #2 has the READPAST hint.

???

Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select row in GridView WITHOUT using Select button rao965 ASP.NET 2.0 Professional 1 February 15th, 2008 10:44 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
READPAST Hint in SELECT statement won't work mike_abc SQL Server 2000 0 June 29th, 2005 08:08 AM
select="node1", select="node2"... Baldo XSLT 7 March 12th, 2004 10:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.