Jump to content
Software FX Community

ChartFx maps through SQL


Recommended Posts

i am trying to load data from sql to the map as follows :

when i try loading the contents of database to map via .cs file as

Chart chart1 = new Chart();   protected void Page_Load(object sender, EventArgs e)   {   Map1.LabelLinkFile = (Path.Combine(Server.MapPath("App_Data"), @"link.xml"));   Map1.MapSource = "World\\WorldCountries.svg";   string mySelectQuery = "select countryname,sum(ElectricityUse)as electricity from AcctRptdata,country where IdCountryCode=countrycode group by countryname";   string dataPath = Path.Combine(Server.MapPath("App_Data"), "DEMO_2_DB_2008FEB13.MDF");   string myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0};",dataPath);   System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(myConnectionString);   System.Data.DataSet ds = new System.Data.DataSet();   System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);   adapter.Fill(ds,"country");   chart1.DataSourceSettings.Fields.Add(new FieldMap("countryname", FieldUsage.Label));   chart1.DataSourceSettings.Fields.Add(new FieldMap("electrcity", FieldUsage.Value));   chart1.ConditionalAttributes.Clear();   ConditionalAttributes condition1 = new ConditionalAttributes();   ConditionalAttributes condition2 = new ConditionalAttributes();   condition1.Condition.To = 1400000;   condition1.Color = Color.Green;   condition2.Color = Color.Red; condition2.Condition.From = 1400001;   condition2.Condition.To = 7200000;   chart1.ConditionalAttributes.Add(condition1);   chart1.ConditionalAttributes.Add(condition2);   chart1.ConditionalAttributes.Recalculate();   }



it gives an oledbException(unrecognised db format) at adapter.fill method.... what are we supposed to write at  adapter.fill method in those inverted commas in this case ...



and when i try loading the sql conents from source instead of .cs file as

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DEMO_2_DB_2008FEB13ConnectionString %>"   SelectCommand=" select countryname,sum(ElectricityUse)as electricity from AcctRptdata,country where IdCountryCode=countrycode group by countryname order by electricity">   </asp:SqlDataSource>

and the rest of code for .cs file is same as above then only the few countries returned from the query are highlighed in blue color... why is the conditional attributes not being applied to the map in this case...


please answer for both the cases.

thank u 

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...