This project has moved. For the latest updates, please go here.

Display Value to SQL 2005

Topics: Algorithms, CompactFramework, Data Access, Español, General Topics, Italiano, SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, Web Controls, WinForms Controls
Jun 17, 2011 at 5:02 AM

i have a database (SQL2005) 


id (int)  

name (nvarchar)

X      (float)

Y      (float)

i need display coordinate of point  and name on Shapefile.

Can SharpMap display?

Thankyou very much?

Jun 17, 2011 at 7:46 AM

You have two options:

  • Load the whole table into a DataTable and use DataTablePoint provider
  • Use OleDbPoint provider

Hth FObermaier






Jun 17, 2011 at 8:16 AM
Edited Jun 17, 2011 at 9:53 AM

i used code following:

 protected void Page_Load(object sender, EventArgs e) 


SharpMap.Map myMap = new SharpMap.Map(new System.Drawing.Size((int)imgMap.Height.Value, (int)imgMap.Width.Value));     

  string oid = "Stationid";     

  string tablename = "RAIN";     

  string xColumn = "X";     

  string yColumn = "Y";  

  SharpMap.Layers.VectorLayer layStation = new SharpMap.Layers.VectorLayer("Station");   

  string ConnStr = @"Server=MANH-PC;uid=sa;pwd=123456;DataBase=DSS"; 

   layStation.DataSource = new SharpMap.Data.Providers.OleDbPoint(ConnStr,tablename,oid,xColumn,yColumn);   

  myMap.Layers.Add( layStation); 

 System.Drawing.Image img = myMap.GetMap();     

  string imgID = SharpMap.Web.Caching.InsertIntoCache(1, img); 

 imgMap.ImageUrl = "getmap.aspx?ID=" + HttpUtility.UrlEncode(imgID);   


=> I get error as follows:

Object reference not set to an instance of an object.

Jun 17, 2011 at 9:16 AM

Please provider full stack trace

thanks FObermaier