I have a drill down chart that i built in ASP.net using C#, in Microsoft Visual Studio 12 and an ACCESS database.
These are my connection string and sql query statement
string myConnectionString = "Path";
string mySelectQuery = "mysqlstatement";
Path and mysqlstatement are just examples because I dont get much space to write here on stackoverflow text box. Nevertheless
using (OleDbConnection myConnection = new OleDbConnection(myConnectionString))
{
OleDbCommand myCommand = new OleDbCommand(mySelectQuery, myConnection);
myConnection.Open();
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
Chart1.DataBindTable(myReader, "Region Name");
myConnection.Close();
Series Series1 = new Series();
Chart1.Series.Add(Series1);
Series1.XValueMember = "Region Name";
Series1.YValueMembers = "TotalSales";`
This is how I bind data to my chart. I choose a value say 2011 from my drop down list and it load up the appropriate data into Chart1. BUT if I choose 2010 from my drop down list, how can I get a message to appear on screen or label box that says there is no data for this year.
At the moment it just displays a blank chart1 with heading. So i am looking for a condition that checks the series if it contains data or not, if it doesnt that prints that error and breaks or stops.
Thanks in advance