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.
Building and Running the Sample
To build and run this sample
- 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.
- For SQLServer, provide the server name and under Options specify a Database Name, for example, HotBikesDB.
- Open the solution ADOSamp.sln.
- Add the directory containing MsADO15.dll to the Include files path in the VC++ Directories dialog box.
- 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
- If you created a SQL Server data source for this sample in step 1, uncomment the following line in RunADO.cpp:
This disables a SQL command that Microsoft Access can understand but SQLServer cannot:
"ALTER TABLE HotBikes DROP COLUMN ID"
- On the Build menu, click Build Solution.
- 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.