This project has moved and is read-only. For the latest updates, please go here.

how to working with postgresql provider?

Topics: CompactFramework, Data Access, SharpMap v0.9 / v1.x
Nov 11, 2013 at 7:13 AM
Hi list,
I'm a newbie in sharpmap api. I need working with postgresql database. For start, i download sharpmap 1.0 final, create new vs 2010 professional (10.0.30319.1) project, add reference to sharpmap.dll into project and coding like this tutorial: .
My problem is in this line:
layRoads.DataSource = new __SharpMap.Providers.PostGis__(connStr, tablename, idColumn);
there is no SharpMap.Providers. I have try with SharpMap.Data.Providers but there no providers for postgis here.
So my question is: Is there postgis datasource provider in sharpmap 1.0 final? If yes, how to working with this?
Another question is: I also checkout source (sharpmap 1.0 final) from svn but it seem user newer visual studio version than my vs version. So the question is: which are requirements to develop sharpmap?
Pls hep me. Thank!
Nov 11, 2013 at 7:29 AM
Edited Nov 11, 2013 at 8:01 AM
i solved my first problem with this code and dll:
string connStr = "Server=;Port=5432;User Id=postgres;Password=postgres;Database=ecl_haiphong";
            string tablename = "hp_thuadat";
            string idColumn = "gid";

            var StreetsProvider = new SharpMap.Data.Providers.PostGIS(connStr, tablename, "the_geom", idColumn); //SharpMap.Extensions dll
            SharpMap.Layers.VectorLayer lyrThuaDat = new SharpMap.Layers.VectorLayer("hp_thuadat", StreetsProvider);
            GeoAPI.Geometries.Envelope envelope = lyrThuaDat.Envelope; //GeoAPI dll

            //Label1.Text = envelope.Centre.X.ToString();
            string soto = "MC48";
            StreetsProvider.DefinitionQuery = string.Format("\"soto\" like '{0}'", soto);

            var ds = new SharpMap.Data.FeatureDataSet();
            StreetsProvider.ExecuteIntersectionQuery(envelope, ds);
            Label1.Text = ds.Tables[0].Rows.Count.ToString();
Marked as answer by truongpm on 11/11/2013 at 12:01 AM