Load Vector Data from a SQL Geometry Field of the Data Table
This document describes the basics of working with SQL Geometry using the Map Control.
This subject is broken down into the following sections.
Overview
Using the Map control, you can load and show any set of shapes stored in the database in the SQL Geometry format.
Note
For more information, see the following link: geometry Data Type.
The image below demonstrates the data source shape loaded from SQL Geometry, representing the Australian shoreline.
Load SQL Geometry Data
To load vector data from a SQL Geometry data source, do the following.
- Create a SqlGeometryDataAdapter object.
- Configure the connection string using the SqlGeometryDataAdapter.ConnectionString property.
- Customize the SQL query to the database using the SqlGeometryDataAdapter.SqlText property.
- Specify the name of the spatial data member using the SqlGeometryDataAdapter.SpatialDataMember property.
- Assign the SqlGeometryDataAdapter to the VectorLayer.Data property.
Note
All field values of the SQL data table loaded from the data base, and not specified as the SqlGeometryDataAdapter.SpatialDataMember property value, will be provided as attributes for each loaded SqlGeometryItem object.
Examples
To learn how to load data from the SQL Geometry field of a data table, see the How to: Load Data from a SQL Geometry Datasource example.