Mapinfo ado.net data provider, Miconnection – Pitney Bowes MapXtreme User Manual

Page 182

Advertising
background image

Chapter 8: Working with Data

MapInfo ADO.NET Data Provider

MapXtreme v7.1

189

Developer Guide

MapInfo ADO.NET Data Provider

MapXtreme provides mechanisms for issuing SQL commands which return record sets from tables
using ADO.NET. The MapInfo ADO.NET Data Provider is one mechanism for accessing data in
.NET applications in this fashion. For an alternative that uses the Feature class and SearchInfo
methods on the Catalog, see

Features and Feature Collections

.

The following sections present the key interfaces and classes for accessing data via the MapInfo
ADO.NET Data Provider.

MIConnection

MICommand

MIDataReader

MapInfo SQL

MIConnection

An MIConnection represents a connection to the Catalog. The connection provides a starting point
for issuing SQL commands and obtaining results. Whereas most data provider connections allow
the user to immediately begin issuing queries or other commands against existing tables (or schema
objects), the MapInfo ADO.NET Data Provider initially has no tables available. Tables need to be
opened or created before they can be accessed. When opened, a name (alias) can be associated
with the table which is used when resolving identifiers in the query engine.

Connections are not pooled in the MapInfo Data Provider and there is no connection string required
to create a new connection.

The MapInfo.Engine.Session class creates and initializes the Catalog which may be accessed
through the Session.Current.Catalog property. The MIConnection.Open method obtains a reference
to the Catalog using the Session.Current.Catalog property and the MIConnection.Close method sets
the internal reference to the Catalog to null.

VB example:

Public Shared Sub MapInfo_Data_MIConnection()
Dim connection As MIConnection = New MIConnection
Dim command As MICommand = connection.CreateCommand()

Advertising