Nevron .NET Vision
Diagram for .NET / User's Guide / Maps / Data Binding

In This Topic
    Data Binding
    In This Topic

    The data binding feature of Nevron Map for .NET lets you easily insert additional attributes to map features from a data source. The data binding process passes through the following stages:

    1. Create and configure a data binding source - this specifies where the binding data comes from. Currently the following data sources are supported: SQL, OleDb, data table.
    2. Create a binding context - this specifies the columns from the map layer's data table and the data source that should match as well as the columns from the binding source that should be imported to the map layer's data table.
    3. Call the DataBind method of the map layer passing the binding source and context.
    Note that the data binding should always be performed after you have called the Read method of the map importer. This ensures that the map layers' data will be properly loaded prior to data binding.

    The following code demonstrates how to bind a map layer to a Microsoft Access database:

    Example Title
    Copy Code
    // Create a data binding source
    NMapOleDbDataBindingSource source = new NMapOleDbDataBindingSource(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}\..\..\..\Resources\Maps\Sales.mdb");
    source.SelectQuery = "SELECT * FROM Sales";
    
    // Create a data binding context
    NMapDataBindingContext context = new NMapDataBindingContext();
    context.AddColumnMatching("CNTRY_NAME", "Country");
    context.ColumnsToImport.Add("Sales");
    
    // Perform the data binding
    countries.DataBind(source, context);