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

Specied Cast not valid error

Topics: General Topics
Aug 14, 2006 at 8:27 AM
SharpMap.Layers.VectorLayer mylayer = new SharpMap.Layers.VectorLayer("mylayer");

string connstr = "server=localhost;database=GeoDatabase;uid=sa;pwd=password";

mylayer.DataSource = new SharpMap.Data.Providers.MsSql(connstr, "India", "WKB_Geometry", "oid");

mylayer.Style.Outline = new Pen(Color.LightBlue, .1f);
mylayer.Style.EnableOutline = true;
mylayer.Style.Fill = new SolidBrush(Color.WhiteSmoke);

SharpMap.Styles.VectorStyle min = new SharpMap.Styles.VectorStyle();
SharpMap.Styles.VectorStyle max = new SharpMap.Styles.VectorStyle();
min.Outline.Width = 1f; //Outline width of the minimum value
max.Outline.Width = 3f; //Outline width of the maximum value

// gives error in Zoomto extents as specified cast not valid
mymap1.Image = myMap.GetMap();
Aug 14, 2006 at 11:22 AM
Do you have fields for X and Y coordinate...I take it you using a sql database...Check if the fields datatype is int(4) or if that doesnt work use datatype real.Cause I think int doesnt allow for decimal values but real does

Hope this help