Hi,
I used PostgreSQL instead of SQL2008, but the code is similar. I used Ben's example here, see the code snippet below, why the first line of code I added output a number >0, but the 2nd line of code I added output a number of 0.
Is there anything wrong here?
string connectString = "Data Source=192.168.0.58,1041;Initial Catalog=InternalDB;Persist Security Info=True;User ID=username;Password=password";
TempMsSql2008FeatureLayer sql2008Layer = new TempMsSql2008FeatureLayer(connectString, "cntry02", "ID");
sql2008Layer.Srid = 4326;
sql2008Layer.Open();
sql2008Layer.ExecuteNonQuery("create view cntry02view as select id, SIZE, geom from cntry02;");
console.writeline("Count=" & sql2008Layer.FeatureSource.getCount(); //Rose added
sql2008Layer.Close();
sql2008Layer = new TempMsSql2008FeatureLayer(connectString, "cntry02view", "ID");
sql2008Layer.Srid = 4326;
sql2008Layer.Open();
sql2008Layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
sql2008Layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
winformsMap1.StaticOverlay.Layers.Add("Sql2008Layer", sql2008Layer);
console.writeline("Count=" & sql2008Layer.FeatureSource.getCount(); //Rose added
Rose