home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / adosamp / adosamp.txt next >
Encoding:
Text File  |  1998-04-03  |  1.6 KB  |  43 lines

  1. /******************************************************************
  2.     3-Tier client server example using ADO/ATL/VCCOM
  3.     (For Access or SQLServer using Windows NT 4.0)
  4. *******************************************************************/
  5.  
  6. SET UP DSN:
  7.  
  8. Under NT4 go to the ODBC Data Source Administrator in Control Panel.
  9. Using either Access or SQLServer, add a (User) DSN with
  10. Data Source Name: HotBikes
  11.  
  12. For Access, create a Database test.mdb (for example).
  13.  
  14. For SQLServer, provide the Server name and under Options
  15. specify a Database Name HotBikesDB (for example).
  16.  
  17. BUILD MIDDLE TIER:
  18.  
  19. Open samples\com\ADOSamp\Server\ADOSamp.dsw.
  20. In StdAfx.h edit the path of MSADO10.dll in the #import statement.
  21. If OleDB/ADO has not been installed do it from the DevStudio CD.
  22. It will most likely be installed in 
  23.     \Program Files\Common Files\System\ADO\MSADO10.DLL.
  24. Build ADOSamp as either an in-proc (DLL) or local (EXE) server.
  25. Registration should be automatic, however if necessary run
  26. regsvr32 ADOSamp.dll or ADOSamp.exe /RegServer.
  27.  
  28. BUILD CLIENT:
  29.  
  30. Open samples\com\ADOSamp\RunADO\RunADO.dsw.
  31. Near the top of RunADO.cpp is the line:
  32.  
  33. //#define SQLSERVER
  34.  
  35. Uncomment this line if using SQLServer.  This disables a SQL command
  36. that Access can understand but SQLServer cannot:
  37.     "ALTER TABLE HotBikes DROP COLUMN ID"
  38.  
  39. Run RunADO.exe.  A table will be created (the existing one deleted), 
  40. several rows added, deleted and updated.  A new column is added, 
  41. populated with data and in the case of Access, a column is deleted.  
  42. The contents of the table is displayed after each modification.
  43.