将量表与mysqlquery连接

时间:2018-10-14 12:43:13

标签: mysql charts gauge livecharts

在我的wpf项目中,我正在使用livecharts的压力表,请参阅我的XAML代码:

<lvc:Gauge x:Name="gauge1" Grid.Row="2" Grid.Column="0" Margin="5" From="0" To="5" Value="0" />

默认情况下,此处设置了“发件人”,“发件人”和“值”值的显示数字。但是,我想用sql查询的结果替换这些数字。此刻,我后面的代码“ To”看起来像这样:

private void PPMRFQSOVERVIEW_Loaded(object sender, RoutedEventArgs e)

    {

        string connectionString = "SERVER=localhost;DATABASE=test;UID=root;PASSWORD=;sslmode=none";
        MySqlConnection connection = new MySqlConnection(connectionString);



        connection.Open();
        MySqlCommand cmd = new MySqlCommand("SELECT Count(test.projectrfqs.lotid) AS Count_lotid FROM test.projectrfqs INNER JOIN test.projectdetails ON test.projectdetails.PJTdetailsID = test.projectrfqs.PJTdetailsID WHERE test.projectdetails.PJTno = @PJTno", connection);
        cmd.Parameters.AddWithValue("@PJTNo", GlobalClass.PJTNo);
        MySqlDataReader myReader;
        myReader = cmd.ExecuteReader();

       /// what has to follow here?

        connection.Close();


    }

我缺少该部分,即如何将COUNT查询的结果显示到gauge1的值“ To”中。有人有主意吗?

任何提示将不胜感激。

谢谢。

0 个答案:

没有答案