SAMPLE: ATL2ADO.exe Returns Disconnected ADO RecordsetID: Q200122
|
ATL2ADO.exe is a sample that demonstrates a minimal three-tiered Database Application using ADO 2.0. It also demonstrates the following:
The following file is available for download from the Microsoft
Software Library:
ATL2ADO.exeRelease Date: Mar-02-1999
Q119591 How to Obtain Microsoft Support Files from Online Services
FileName Size
---------------------------------------------------------
adostudent.mdb 72
readme.txt 491
helper.idl 21
R1ADOdrsExe.aps 4332
R1ADOdrsExe.cpp 4447
R1ADOdrsExe.dsp 12760
R1ADOdrsExe.dsw 545
R1ADOdrsExe.h 84
R1ADOdrsExe.idl 756
R1ADOdrsExe.ncb 33792
R1ADOdrsExe.rc 2941
R1ADOdrsExe.rgs 185
R1ADOdrsExeps.def 253
R1ADOdrsExeps.mk 502
r1DisRS.cpp 473
r1DisRS.h 891
r1DisRS.rgs 645
resource.h 549
StdAfx.cpp 315
StdAfx.h 1091
"SELECT * FROM Student WHERE GradYear > ?"
Build the Visual C++ project with Visual C++ 6.0 to create and register the server and the proxy/stub DLL. Build the Visual Basic project with Visual Basic version 6.0. You can build the server on one computer and the client on another computer on the same network. Copy the included Access database, ADOStudent.mdb, to C:\test (or change the connection string in the source file).
getRS([in,optional,defaultvalue(88)] short GY, [out, retval]_Recordset **ppRS);
ConnString([in] BSTR newVal);
UpdateBat( _Recordset *ppRS);
struct _Recordset;
#if !defined(__cplusplus) || defined(CINTERFACE)
typedef struct _Recordset _Recordset;
#endif
ADO is imported through the file stdAfx.h with the following two lines:
#undef EOF // Necessary for EOF collision.
#import "msado15.dll" no_namespace // Correct place to import ADO.
From the Project Settings menu, click Post Build tab, add the "build & Reg Proxy/Stub DLL" as the description, and add the following two commands:
nmake /f R2ADOmodps.mk
regsvr32 R1ADOdrsExeps.dll
This allows Visual C++ to automatically build and register the proxy/stub DLL. You must also specify Win32 Debug on the build bar.
Set idrs = CreateObject("R1ADOdrsExe.r1DisRS", "Computer1")
// Use the following SQL to create the student table on SQL Server.
CREATE TABLE student
(studentID int IDENTITY (1000, 1) NOT NULL ,
name text NULL ,
gradYear int NULL )
GO
INSERT INTO student (name, gradYear)
VALUES ('Billy Reubin', 99)
go
INSERT INTO student (name, gradYear)
VALUES ('Joe Mana', 98)
go
INSERT INTO student (name, gradYear)
VALUES ('Willy Klifton', 69)
go
INSERT INTO student (name, gradYear)
VALUES ('Lerry ElvisSon', 73)
go
For additional information, please see the following
articles in the Microsoft Knowledge Base:
Q182389 FILE: Adovcbm.exe ADO 1.5 with #import and Getrows/Bookmarks
Q184968 FILE: Adovcsp.exe Demonstrates Using Stored Procedures with ADO
Q186387 SAMPLE: Ado2atl.exe Returns ADO Interfaces from COM
Q181733 FILE: Adovcbtd.exe #import Using UpdateBatch and CancelBatch
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Rick Anderson, Microsoft Corporation
Additional query words:
Keywords : kbfile kbsample kbDatabase kbSDKDataAc kbVBp600 kbVC600
Version : WINDOWS:2.0,6.0; winnt:6.0
Platform : WINDOWS winnt
Issue type :
Last Reviewed: March 29, 1999