Creating graph in Windows Forms Application Mysql C# Data Binding a Chart to a Database C# Line chart in c# using data from database c# – Graph database …
Original source
Creating graph in Windows Forms Application Mysql C# Data Binding a Chart to a Database C# Line chart in c# using data from database c# – Graph database …
Original source
27 responses to “C# Tutorial 15: How to Link Chart /Graph with Database”
Sir please tell me how to display the maximum,minimum & average age from the graph.
Sir,Your tutorials are very useful for me.thank you very very much.
Instead of while loop with Reader, why not fill the Data with DataSet/DataTable
& just assign it as datasource to chart
chart1.Series.Add("age");
chart1.Series["emp"].XValueMember = "name";
chart1.Series["emp"].YValueMembers = "age";
chart1.DataSource = data;
chart1.DataBind();
I do this chart1.ChartAreas[0].AxisX.Title = "Age";
chart1.ChartAreas[0].AxisY.Title = "Name";
after finishing the coding as illustrated i got the message "the type or namespace charting does not exist in namespace System.Windows.Forms.DataVisualization"
and when i tried to use Using System.Windows.Forms.DataVisualization.Charting again the same message appears there
anyone please suggest me how to solve this problem and if System.Windows.Forms.DataVisualization.Charting.dll can be added to the reference please provide the link to download it
Can you make one that has a date range using date/time picker?
it is connection to sql server 2008 and not by server explorer in visual studio 2008.
I hope it is useful for you.
thank you for post.
SqlConnection con1 = new SqlConnection();
con1.ConnectionString = "Data Source=(local);Initial Catalog=DatabaseName;Integrated Security=true";
con1.Open();
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = con1;
cmd1.CommandText = "select ProductName,PriceProduct from Producttb";
try
{
SqlDataReader dr = cmd1.ExecuteReader();
while (dr.Read())
{
chart3.Series["te1"].Points.AddXY(dr["ProductName"].ToString(), dr["PriceProduct"].ToString());
}
con1.Close();
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
Thanks a lot bro, it's so helpful
Hello. I got an error on this line
myReader.GetString("PRES_NAME"), myReader.GetInt32("PRES_VOTE")
the whole line is underlined
it says that "Argument 1: Cannot convert from string to int"
Great Tutorial !
Better English will be appreciated 🙂
this.chart1.Series["Age"].Points.AddXY(reader["name"].ToString(), reader["age"].ToString());
Hi all,
I am trying to get the chart axis title automatically from the data table columns but having problem. So far I can do it manually as follows:
this.chartTable.ChartAreas[0].AxisX.Title = "Age";
this.chartTable.ChartAreas[0].AxisY.Title = "Name";
Any help will be appriciated and tanks for the good work.
Hi how can i print this chart in the crystal report
having an error inside while
.getstring("name") invalid cast exception
Hi: good work. how to do it in qlServer
this.chart1.Series["YYY"].Points.AddXY(myReader.GetDateTime ., myReader.GetNumber).
I hopeto hearfro you…
best tutorial, plz give me the next video link which u told in this video
Howcomes yours comes out so neat.. mine is all scrumbled up
how can i create a dynamic graph which updates automatically when the database is updated..,thanks
Great, Thanks
BEST TUTORIAL EVER!!!!!!!!
hi, I am using Sql Database.
i want to display the name of my database name column on the x axis on my graph,can u tell me how can i do it.
and also want to fetch the data from a particular row at a time and display it on the graph.
how to retrieve image from mysql in java asked the author of java prog#, I follow his tutorial how to insert image and retrieve, I can insert image in db but I can't retrieve, no erros, no reaction after click to the retrieve buton please help me
Great channel very usefull i really say u
Best one yet, very useful!
Thank you.
How to insert data into related tables ? help please! c# mysql ?
Thank you very much!!!
A question:
How can this in PHP? Im gratefull with your video!
how can we connect chart with datagridview?
pls help.
i mean, i want to plot a chart based upon the values stored into datagridview table..