Exemple #1
0
        /// <summary>
        ///     Gets the shapefile connection.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="geometryType">Type of the geometry.</param>
        /// <returns>
        ///     Returns a <see cref="OleDbConnection" /> representing the OLE DB connection.
        /// </returns>
        public static OleDbConnection GetShapefileConnection(string fileName, OleDbGeometryType geometryType)
        {
            string connectionString = string.Format("Provider=ESRI.GeoDB.OleDB.1;Data Source={0};Extended Properties=WorkspaceType=esriDataSourcesFile.ShapefileWorkspaceFactory.1;Geometry={1}", fileName, geometryType.ToString().ToUpperInvariant());

            return(new OleDbConnection(connectionString));
        }
Exemple #2
0
        /// <summary>
        ///     Gets the access connection.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="geometryType">Type of the geometry.</param>
        /// <returns>
        ///     Returns a <see cref="OleDbConnection" /> representing the OLE DB connection.
        /// </returns>
        public static OleDbConnection GetAccessConnection(string fileName, OleDbGeometryType geometryType)
        {
            string connectionString = string.Format("Provider=ESRI.GeoDB.OleDB.1;Data Source={0};Extended Properties=WorkspaceType=esriDataSourcesGDB.AccessWorkspaceFactory.1;Geometry={1}", fileName, geometryType);

            return(new OleDbConnection(connectionString));
        }