# ADOSAMP Sample: Implements a Three-Tier Client/Server Application

This sample implements a three-tier client/server application using ADO, ATL, and compiler COM support.

The sample demonstrates how you can use compiler COM support with ADO to create a client/server database application. The application creates a small database of information about motorcycles and their top speeds. The application inserts rows, deletes rows, adds a new column, and searches on top speeds greater than a specified value.

Security Note
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.

# Building and Running the Sample

Note
If you are running Visual C++ Express Edition, you might need to install the Platform SDK before running this sample. For information on how to do this, see How to: Use Visual C++ Express Edition with the Microsoft Platform SDK.

#### To build and run this sample

1. In the Control Panel, open the Administrative Tools folder and then double-click Data Sources (ODBC). If you are using either Microsoft Access or SQLServer with this sample, add a (User) DSN with a Data Source Name "HotBikes." If you are using Microsoft Access, create a database called Test.

2. For SQLServer, provide the server name and under Options specify a Database Name, for example, HotBikesDB.

3. Open the solution ADOSamp.sln.

4. Add the directory containing MsADO15.dll to the Include files path in the VC++ Directories dialog box.

5. If either OLE DB or ADO has not been installed, install it from the Visual Studio CD or DVD. It will most likely be installed in:

   \Program Files\Common Files\System\ADO\MsADO15.dll

6. If you created a SQL Server data source for this sample in step 1, uncomment the following line in RunADO.cpp:

       //#define SQLSERVER

   This disables a SQL command that Microsoft Access can understand but SQLServer cannot:

   `"ALTER TABLE HotBikes DROP COLUMN ID"`

7. On the Build menu, click Build Solution.

8. On the Debug menu, click Start Without Debugging. A table will be created (deleting the existing one), and several rows will be added, deleted, and updated. A new column will be added and populated with data. In the case of Microsoft Access, a column will be deleted. The contents of the table will be displayed after each modification.