This article was previously published under Q195048
This article has been archived. It is offered "as is" and will no longer be updated.
The Execute method of the ActiveX Data Objects (ADO) Command object passesby reference an integer value that you can use to retrieve the number ofrecords affected by a SQL UPDATE command.
The following example establishes a DSN-less connection to the SQL Serversample table ROYSCHED in the PUBS database, executes a SQL UPDATE command,displays the number of records affected by the command, then executesanother UPDATE command to restore the ROYSCHED table to its previous state.
NOTE: Modify the SERVER component of the lcConnString variable, the lcUIDand lcPWD variables as appropriate for your SQL Server installation.
In order to use this example, you must have Microsoft Data AccessComponents (MDAC) version 2.x or later installed, which is included in thedata components of Visual Studio 6.0 or can be downloaded from thefollowing Web address: