This (the kb article is not wonderfully informative.
How does an application query "the identity column of a newly inserted
row"? Are we talking @@Identity?
How long is a newly inserted row a newly inserted row?
This occurs, according to the article, when we use a client side cursor.
So let's check:
First, do I qualify?
Microsoft SQL Server Management Studio Express 9.00.2047.00
Microsoft Data Access Components (MDAC) 6.0.6000.16386 (vista_rtm.061101-
2205)
Operating System 6.0.6000
Think so, but who can be sure?
Sub temp()
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Set c = New ADODB.Connection
With c
..CursorLocation = adUseClient
..Open CurrentProject.BaseConnectionString
..Execute ("SET NOCOUNT ON")
End With
Set r = New ADODB.Recordset
With r
..ActiveConnection = c
..CursorLocation = adUseClient
..CursorType = adOpenStatic
..LockType = adLockOptimistic
..Open "SELECT * FROM Schools"
..AddNew Array(1), Array("Test")
Debug.Print .ActiveConnection.Execute("SELECT @@Identity")(0)
‘ 5280 – no bug here
..AddNew Array(1), Array("A Second Test")
Debug.Print .ActiveConnection.Execute("SELECT ID FROM Schools WHERE Name
= 'A Second Test'")(0)
‘ 5281 – no bug here
End With
Whew! My personal VBA code and ASP code and HTA Script may not be
affected.
But can I be sure that bound forms in Access aren’t affected? I don’t
know. Access is an application. One has only to look at Northwinds, the
code produced by Access Wizards, and various KB solutions to realize that
MS is indifferent to good programming and coding practices. So does this
article mean a bound form in an ADP may fail?
I have a couple ADPs in operation but no problem like the one described
has ever been reported to me.
I won’t worry about this right now, but perhaps, someone else will post
code that will demonstrate the bug?
"Tony Toews [MVP]" <tt****@telusplanet.netwrote in
news:g6********************************@4ax.com:
Thanks to a posting by fellow MVP Steve Foster
On a computer that is running Windows Vista, Windows Server 2008, or
Windows XP, an incorrect value is returned when an application queries
the identity column value of a newly inserted row in various versions
of SQL Server 2005 and of SQL Server 2000
http://support.microsoft.com/kb/951937