Draw using ADODraw with the ESRI OLE DB provider



Description:

The ADODraw sample demonstrates how to create a Microsoft® Visual Basic® or Visual C++® application to fetch data from a Geodatabase or ESRI file-based data source using Microsoft ActiveX® Data Objects (ADO). It utilizes several of ESRI's components/interfaces to set the geographic extent and display the data. OGIS compliant spatial query operators are included to support analysis of the data.
Products:
Engine: VB6, VC++

Platforms: Windows

Minimum ArcGIS Release: 9.0

How to use:
[VB6]
  1. Build and run the ADODraw.exe from the Visual Basic ADODraw project.
  2. Use the 'add data' utility to navigate to the desired data source. NB: A connection to a shapefile or coverage data source is made to the directory which contains the shapefile or coverage data; not the individual shapefiles or coverages themselves. When browsing for shapefiles and coverages, navigate to and open the directory you are interested in and click on 'accept'. A list of available data sets to select from will appear.
  3. Click on OK to close the dialog. Choose the data set you wish to view by selecting File>Open from the main menu and select from the pulldown list of available data sets.
[VC++]
  1. Build and run the ADODraw.exe from the Visual C++ ADODraw project.
  2. Supply the appropriate connection information for your data source in the Data Link Properties dialog. For example, to open a personal geodatabase file, enter the path to and name of the file in the "data source" input field on the "Connection Tab". Click on "All" tab and set the Extended Properties value for the connection to "workspacetype=esriDataSourcesGDB.AccessWorkspaceFactory.1". (double-click on Extended Properties to bring up dialog to change the value). To open an ArcSDE geodatabase, set the name of the server in the "location" input field on the "Connection" tab and supply the user name and password for the connection. Set the Extended Properties value on the "All" tab to "workspacetype=esriDataSourcesGDB.sdeworkspacefactory.1;version=sde.DEFAULT;instance=esri_sde", Click on OK to close the dialog. Choose the data set you wish to view by selecting File>Open from the main menu and select from the pulldown list of available data sets. NB: This application is a standard template application which includes some options which are not enabled in this sample; for example the edit menu is disabled.

Download the VB6 files
ADODraw.vbp The VB project file for ADODraw.
frmADODraw.frm Contains a MS Hierarchical flexgrid control and picture box control to display the data.
frmArcSDE.frm Dialog for supplying ArcSDE connection properties
frmBrowse.frm File sytsem browser.
frmDataSrc.frm Dialog for selecting an ESRI data source to query.
frmFClst.frm Dialog to list/select available feature classes.
frmSelByAttr.frm Dialog for selecting attributes to query the feature class.
Download the Visual C++ files
ADODraw.dsp The VC++ project file for ADODraw (based on standard VCPP doc-view architecture).
Oledbgis.h Precompiled header file. It contains the GUIDs and constants that are required by the OpenGIS Simple Features for OLE-COM Specification.
Stdafx.h Precompiled header file.
Us_states.mdb Sample geodatabase dataset.

Download the files for all languages



Key CoClasses:GeometryEnvironment, Envelope, ScreenDisplay, SimpleFillSymbol, SimpleMarkerSymbol, SimpleLineSymbol, ADO Connection, ADO Recordset, ADO Fields
Key Interfaces: ISpatialReference, IGeometryFactory