A newer version of this page is available. Switch to the current version.

SqlGeometryDataAdapter.ConnectionString Property

Gets or sets the connection string to a SQL database.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.2.dll


public string ConnectionString { get; set; }
Public Property ConnectionString As String

Property Value

Type Default Description


A String object.


To load data from a SQL Geometry data source, do the following.

  1. Create a SqlGeometryDataAdapter object.
  2. Specify its SqlGeometryDataAdapter.ConnectionString, SqlGeometryDataAdapter.SqlText and SqlGeometryDataAdapter.SpatialDataMember properties.
  3. Assign this object to the VectorItemsLayer.Data property.

All data table field values loaded from the database will be provided as attributes for each SqlGeometryItem object generated using SqlGeometryDataAdapter.

const string filePath = "..\\..\\Data\\SQLG.mdf";

private void Form1_Load(object sender, System.EventArgs e) {
    string fullFilePath = Path.GetFullPath(Path.Combine(Application.StartupPath, filePath));
    SqlGeometryDataAdapter adapter = new SqlGeometryDataAdapter() {
        ConnectionString = "Data Source=(local);AttachDbFileName=" + fullFilePath + 
            ";Database=SqlGeometryDB;Integrated Security=True;MultipleActiveResultSets=True",
        SqlText = "SELECT TOP 1000 [GeomCol1],[TextCol] FROM [dbo].[DemoTable]",
        SpatialDataMember = "GeomCol1"
    VectorItemsLayer layer = new VectorItemsLayer() {
        Data = adapter,
        ShapeTitlesPattern = "{TextCol}"
    layer.DataLoaded += layer_DataLoaded;

void layer_DataLoaded(object sender, DataLoadedEventArgs e) {
See Also