Micommand – Pitney Bowes MapXtreme User Manual

Page 183

Advertising
background image

Chapter 8: Working with Data

MapInfo ADO.NET Data Provider

MapXtreme v7.1

190

Developer Guide

command.CommandText = "Select * From States Where Pop > 1000000"

connection.Open()
Dim reader As MIDataReader = command.ExecuteReader()
Dim i As Integer, n As Integer = reader.FieldCount
For i = 0 To n - 1 Step i + 1
Console.Out.Write("{0}\t", reader.GetName(i))
Next
Console.Out.WriteLine()
While reader.Read()
For i = 0 To n - 1 Step i + 1
Dim o As Object = reader.GetValue(i)
If o Is DBNull.Value Then
Console.Write("null\t")
Else
Console.Write("{0}\t", o.ToString())
End If
Next
Console.Out.WriteLine()
End While
reader.Close()
command.Dispose()
connection.Close()
End Sub

MICommand

MICommand provides the necessary interface for executing SQL commands against the MapInfo
Data Provider. MICommand creates MIDataReader and MIScrollableReader instances for obtaining
data via the ExecuteReader and ExecuteScrollableReader methods, respectively.

Supported Commands

The commands that are understood by the MICommand are:

Select
SELECT < select_list >

FROM { < table_source > } [ ,...n ]
[ WHERE < search_condition > ]
[ GROUP BY expression [ ,...n ] ]
[ ORDER BY {expression | column_position [ ASC | DESC ] } [ ,...n ]]

< select_list > ::=

{

*
| { table_name | table_alias }.*
| { expression } [ [ AS ] column_alias ]

} [ ,...n ]

< table_source > ::=

table_name [ [ AS ] table_alias ]

Advertising