I have a windows form chart that retrieve the x value in mysql database and plot it on a bar graph. This is the the first time I'm doing this so I don't really have an idea why I am getting this error.
public void loadChart()
{
string conn = "server=localhost;user=root;password='';database=cashieringdb;";
string cmdstring = "SELECT sum FROM salessum";
MySqlDataAdapter adapter = new MySqlDataAdapter(cmdstring, conn);
DataTable dt = new DataTable();
adapter.Fill(dt);
chart1.DataSource = dt;
this.chart1.Palette = ChartColorPalette.SeaGreen;
this.chart1.Titles.Add("Daily Record");
int[] pointsArray = a.mysqlSelect("select sum from salessum"); // error in this line
string[] seriesArray = { "Mon", "Tue", "Wed", "Th", "Fri" };
for (int i = 0; i < seriesArray.Length; i++)
{
Series series =this.chart1.Series.Add(seriesArray[i]);
series.Points.Add(pointsArray[i]);
}
Here's the error shows: No matter how much time searching for solution on the internet, but still I ca'nt get this working. Or is there any easy way to retrieve data from database and plot it on the windows form chart?
Error 2 Cannot implicitly convert type 'System.Collections.Generic.List<string>[]' to 'int[]'
EDIT
I change my code to this:
List<string>[] pointsArray = a.mysqlSelect("select sum from salessum"); //no error
Error in this line:
series.Points.Add(pointsArray[i]);