I am developing a C # application and need to fill in a graph with the amount of data registered in 3 MySql tables. It is as follows: The graph should inform the user in different columns how much data are registered in the product tables, logsentrada and logssaida respectively, as in the image below:
Ihavethedifficultyofmakingthispossible.Hereistheimagewiththegraphicintheform:
ConnectionString:
publicclassDadosDaConexao{publicstaticStringservidor="%";
public static String banco = "estoque_box";
public static String usuario = "estBox";
public static String senha = "estoqueBox";
public static String StringDeConexao
{
get
{
return "Server=" + servidor + ";Database=" + banco + ";Uid=" + usuario + ";Pwd=" + senha;
}
}
}
I think this might help:
public void loadChart()
{
MySqlConnection conexao = new MySqlConnection();
conexao.ConnectionString = DadosDaConexao.StringDeConexao;
conexao.Open();
string Query = "select count(*) from produto where pro_cod;";
MySqlCommand cmdDataBase = new MySqlCommand(Query, conexao);
MySqlDataReader myReader;
try
{
myReader = cmdDataBase.ExecuteReader();
while (myReader.Read())
{
this.GrProdutos.Series["Produto"].Points.AddXY(myReader.GetString("pro_cod"), myReader.GetString("pro_cod"));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
conexao.Close();
}